", "error": { "type": "invalid_request_error", "message": "tools.3.custom.input_...
🚨 错误信息
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "tools.3.custom.input_examples: Extra inputs are not permitted"
},
"request_id": "req_011CVVfGtNYFrPQpXFdT9w6G"
} 对应的函数为: {
"name": "Grep",
"description": "A powerful search tool built on ripgrep\n\n Usage:\n - ALWAYS use Grep for search tasks. NEVER invoke `grep` or `rg` as a Bash command. The Grep tool has been optimized for correct permissions and access.\n - Supports full regex syntax (e.g., \"log.*Error\", \"function\\s+\\w+\")\n - Filter files with glob parameter (e.g., \"*.js\", \"**/*.tsx\") or type parameter (e.g., \"js\", \"py\", \"rust\")\n - Output modes: \"content\" shows matching lines, \"files_with_matches\" shows only file paths (default), \"count\" shows match counts\n - Use Task tool for open-ended searches requiring multiple rounds\n - Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use `interface\\{\\}` to find `interface{}` in Go code)\n - Multiline matching: By default patterns match within single lines only. For cross-line patterns like `struct \\{[\\s\\S]*?field`, use `multiline: true`\n",
"input_schema": {
"type": "object",
"properties": {
"pattern": {
"type": "string",
"description": "The regular expression pattern to search for in file contents"
},
"path": {
"type": "string",
"description": "File or directory to search in (rg PATH). Defaults to current working directory."
},
"glob": {
"type": "string",
"description": "Glob pattern to filter files (e.g. \"*.js\", \"*.{ts,tsx}\") - maps to rg --glob"
},
"output_mode": {
"type": "string",
"enum": [
"content",
"files_with_matches",
"count"
],
"description": "Output mode: \"content\" shows matching lines (supports -A/-B/-C context, -n line numbers, head_limit), \"files_with_matches\" shows file paths (supports head_limit), \"count\" shows match counts (supports head_limit). Defaults to \"files_with_matches\"."
},
"-B": {
"type": "number",
"description": "Number of lines to show before each match (rg -B). Requires output_mode: \"content\", ignored otherwise."
},
"-A": {
"type": "number",
"description": "Number of lines to show after each match (rg -A). Requires output_mode: \"content\", ignored otherwise."
},
"-C": {
"type": "number",
"description": "Number of lines to show before and after each match (rg -C). Requires output_mode: \"content\", ignored otherwise."
},
"-n": {
"type": "boolean",
"description": "Show line numbers in output (rg -n). Requires output_mode: \"content\", ignored otherwise. Defaults to true."
},
"-i": {
"type": "boolean",
"description": "Case insensitive search (rg -i)"
},
"type": {
"type": "string",
"description": "File type to search (rg --type). Common types: js, py, rust, go, java, etc. More efficient than include for standard file types."
},
"head_limit": {
"type": "number",
"description": "Limit output to first N lines/entries, equivalent to \"| head -N\". Works across all output modes: content (limits output lines), files_with_matches (limits file paths), count (limits count entries). Defaults based on \"cap\" experiment value: 0 (unlimited), 20, or 100."
},
"offset": {
"type": "number",
"description": "Skip first N lines/entries before applying head_limit, equivalent to \"| tail -n +N | head -N\". Works across all output modes. Defaults to 0."
},
"multiline": {
"type": "boolean",
"description": "Enable multiline mode where . matches newlines and patterns can span lines (rg -U --multiline-dotall). Default: false."
}
},
"required": [
"pattern"
],
"additionalProperties": false,
"$schema": "http://json-schema.org/draft-07/schema#"
},
"input_examples": [
{
"pattern": "TODO",
"output_mode": "files_with_matches"
},
{
"pattern": "function.*export",
"glob": "*.ts",
"output_mode": "content",
"-n": true
},
{
"pattern": "error",
"-i": true,
"type": "js"
}
]
}
🤖 AI解决方案
错误翻译
原文:tools.3.custom.input_examples: Extra inputs are not permitted
译文:工具第3个自定义输入示例:不允许额外的输入
原因分析
这是一个JSON Schema验证错误,发生在工具函数的input_examples数组的第4个元素(索引从0开始)。错误表明在输入示例中包含了模式定义中未允许的额外属性。
查看提供的Grep函数定义,input_schema中明确设置了:
"additionalProperties": false这意味着任何不在
properties列表中定义的属性都会被拒绝。
解决方案
检查并修正input_examples数组中的第4个示例,移除任何不在允许属性列表中的字段。允许的属性包括:
pattern(必需)path,glob,output_mode,-B,-A,-C,-n,-i,type,head_limit,offset,multiline
{
"input_examples": [
{
"pattern": "TODO",
"output_mode": "files_with_matches"
},
{
"pattern": "function.*export",
"glob": "*.ts",
"output_mode": "content",
"-n": true
},
{
"pattern": "error",
"-i": true,
"type": "js"
},
// 确保这里的示例只包含允许的属性
{
"pattern": "your_search_pattern",
// 只使用上面列出的允许属性
}
]
}
️ 预防措施
properties列表中建议:使用json-schema-validator等在线工具预先验证配置文件的合法性。