Skip to content

MCP Server Incompatibility with Gemini due to Strict Naming Conventions #2

@romanilyin

Description

@romanilyin

I encountered an issue when trying to connect the KiCad MCP server (finerestaurant/kicad-mcp-python) to a client using the Google Gemini API. The connection fails with a ClientError: got status: 400 Bad Request.

The detailed error message from Gemini indicates that the problem lies with the naming convention used for functions declared by the MCP server: {"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"* GenerateContentRequest.tools[0].function_declarations[17].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.\\n*

It appears that the tool names generated or exposed by the MCP server do not comply with Gemini's stricter rules for function/declaration names. While these names might adhere to the general MCP specification or work with other LLM providers, they are rejected by Gemini because they likely contain characters not allowed by its specific schema (e.g., spaces, other symbols, or exceed the character limit in a way the current naming scheme does). This suggests a potential compatibility issue between the MCP server implementation and clients connecting to APIs with more restrictive naming conventions than others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions