-
Notifications
You must be signed in to change notification settings - Fork 161
Description
Before you submit
- I have read the Common Issues and ensured this issue is not covered there.
文档里一个 Gemini 报错模板与我的情况不相符。 - I have searched the existing issues and this is not a duplicate.
Describe the bug
在 AIAw.app 中新建 MCP 插件时,如果插件定义的工具名称包含中划线(例如 tavily-search),或者不加任何符号仅仅是英文字母(例如 tavilycf)都会报错。Gemini kimi qwen模型报错(glm 模型正常)
AI 分析是 在调用 对 Function Name 格式有严格要求的模型时会报错。软件似乎未对 MCP 传入的工具名称进行标准化清洗(Sanitize),直接透传给了 LLM API 导致请求被拒绝。
To Reproduce
Steps to reproduce the behavior:
- Go to 'Settings' and configure an MCP Server (e.g., Tavily, which uses names like
tavily-search). - Select a model that uses the Google Gemini API (or any model strict about function naming).
- Start a chat and trigger the tool (e.g., ask it to search something).
- See error: Invalid function name.
Expected behavior
AI 分析 软件应在构造 API 请求前,自动将 MCP 工具名称中的非法字符(如中划线 -)替换为下划线 _ 或进行其他标准化处理,以符合 LLM API 的命名规范(例如将 tavily-search 自动转换为 tavily_search),从而正常调用工具。
Environment
- Platform: 全平台都出现
- Version: 【1.8.7】
Additional context
报错日志如下:***.tools[0].function_declarations[0].name: Invalid function name. Must start with a letter or an underscore. Must be alphameric (a-z, A-Z, 0-9), underscores (), dots (.), colons (:), or dashes (-), with a maximum length of 64.
AI 分析认为这是因为Gemini 等 API 要求 Function Name 必须符合 ^[a-zA-Z0-9]+$ (通常不支持中划线),而 MCP 协议中很多工具默认使用 kebab-case(中划线命名),导致直接转换时出错。
以上是 AI 分析得出的结论,您看有什么信息我能继续提供的?