@lizqwer
大佬你好, 请问一下这个怎么配合 gptel 使用呢?
我已经看到了 Mcp-Hub buffer中已经 connected 了, 我也进行了 register-tool, 也在 gptel-tools 中启用
当我进行使用时返回了错误内容:
Gemini error: (HTTP/1.1 400 Bad Request) Invalid value at 'tools[0].function_declarations[2].parameters.properties[2].value.items' (required), Starting an object on a scalar field
Invalid value at 'tools[0].function_declarations[9].parameters.properties[0].value.items' (required), Starting an object on a scalar field
环境:
gptel => 0.9.8
Model: gemini-2.0-flash-exp (已知这个模型在gptel buffer 和 vscode 中的 cline 中的 mcp-server 正常使用)
Eamcs : 30.1 (正式版)
OS: Windows 10
工具: filesystem
我该怎么排除问题? 是 gptel 问题吗?
gptel-log 调试信息:
{
"gptel": "request body",
"timestamp": "2025-03-19 16:47:25"
}
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hello"
}
]
}
],
"safetySettings": [
{
"category": "HARM_CATEGORY_HARASSMENT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold": "BLOCK_NONE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"threshold": "BLOCK_NONE"
}
],
"system_instruction": {
"parts": {
"text": "You are a large language model and a conversation partner. Respond concisely."
}
},
"tools": [
{
"function_declarations": [
{
"name": "list_allowed_directories",
"description": "Returns the list of directories that this server is allowed to access. Use this to understand which directories are available before trying to access files.",
"parameters": null
},
{
"name": "get_file_info",
"description": "Retrieve detailed metadata about a file or directory. Returns comprehensive information including size, creation time, last modified time, permissions, and type. This tool is perfect for understanding file characteristics without reading the actual content. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
}
},
"required": [
"path"
]
}
},
{
"name": "search_files",
"description": "Recursively search for files and directories matching a pattern. Searches through all subdirectories from the starting path. The search is case-insensitive and matches partial names. Returns full paths to all matching items. Great for finding files when you don't know their exact location. Only searches within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
},
"pattern": {
"type": "string",
"description": ""
},
"excludePatterns": {
"type": "array",
"description": "",
"items": {
"type": "string",
"properties": {},
"required": {}
}
}
},
"required": [
"path",
"pattern"
]
}
},
{
"name": "move_file",
"description": "Move or rename files and directories. Can move files between directories and rename them in a single operation. If the destination exists, the operation will fail. Works across different directories and can be used for simple renaming within the same directory. Both source and destination must be within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"source": {
"type": "string",
"description": ""
},
"destination": {
"type": "string",
"description": ""
}
},
"required": [
"source",
"destination"
]
}
},
{
"name": "directory_tree",
"description": "Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
}
},
"required": [
"path"
]
}
},
{
"name": "list_directory",
"description": "Get a detailed listing of all files and directories in a specified path. Results clearly distinguish between files and directories with [FILE] and [DIR] prefixes. This tool is essential for understanding directory structure and finding specific files within a directory. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
}
},
"required": [
"path"
]
}
},
{
"name": "create_directory",
"description": "Create a new directory or ensure a directory exists. Can create multiple nested directories in one operation. If the directory already exists, this operation will succeed silently. Perfect for setting up directory structures for projects or ensuring required paths exist. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
}
},
"required": [
"path"
]
}
},
{
"name": "edit_file",
"description": "Make line-based edits to a text file. Each edit replaces exact line sequences with new content. Returns a git-style diff showing the changes made. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
},
"edits": {
"type": "array",
"description": "",
"items": {
"type": "object",
"properties": {
"oldText": {
"type": "string",
"description": "Text to search for - must match exactly"
},
"newText": {
"type": "string",
"description": "Text to replace with"
}
},
"required": [
"oldText",
"newText"
]
}
},
"dryRun": {
"type": "boolean",
"description": "Preview changes using git-style diff format"
}
},
"required": [
"path",
"edits"
]
}
},
{
"name": "write_file",
"description": "Create a new file or completely overwrite an existing file with new content. Use with caution as it will overwrite existing files without warning. Handles text content with proper encoding. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
},
"content": {
"type": "string",
"description": ""
}
},
"required": [
"path",
"content"
]
}
},
{
"name": "read_multiple_files",
"description": "Read the contents of multiple files simultaneously. This is more efficient than reading files one by one when you need to analyze or compare multiple files. Each file's content is returned with its path as a reference. Failed reads for individual files won't stop the entire operation. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"paths": {
"type": "array",
"description": "",
"items": {
"type": "string",
"properties": {},
"required": {}
}
}
},
"required": [
"paths"
]
}
},
{
"name": "read_file",
"description": "Read the complete contents of a file from the file system. Handles various text encodings and provides detailed error messages if the file cannot be read. Use this tool when you need to examine the contents of a single file. Only works within allowed directories.",
"parameters": {
"type": "object",
"properties": {
"path": {
"type": "string",
"description": ""
}
},
"required": [
"path"
]
}
}
]
}
],
"generationConfig": {
"temperature": 1.0
}
}
{
"gptel": "response body",
"timestamp": "2025-03-19 16:47:27"
}
{
"error": {
"code": 400,
"message": "Invalid value at 'tools[0].function_declarations[2].parameters.properties[2].value.items' (required), Starting an object on a scalar field\nInvalid value at 'tools[0].function_declarations[9].parameters.properties[0].value.items' (required), Starting an object on a scalar field",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "tools[0].function_declarations[2].parameters.properties[2].value.items",
"description": "Invalid value at 'tools[0].function_declarations[2].parameters.properties[2].value.items' (required), Starting an object on a scalar field"
},
{
"field": "tools[0].function_declarations[9].parameters.properties[0].value.items",
"description": "Invalid value at 'tools[0].function_declarations[9].parameters.properties[0].value.items' (required), Starting an object on a scalar field"
}
]
}
]
}
}