Does Model Context Protocol specify the maximum tool name length?
- User
Does Model Context Protocol specify the maximum tool name length?
- Assistant
In the current “Model Context Protocol” (MCP) specification, a tool’s
nameis simply defined as a JSON string—there is no hard-coded “max length” baked into the protocol itself.Any effective limit on how long your tool names can be will instead come from the implementation you’re using—for example:
- OpenAI’s function-calling API
• Names must be unique, 1–64 chars long, and match^[a-zA-Z0-9_]+$ - LangChain / LangSmith
• No protocol-enforced limit, but very long names can hurt readability - Other LLM-driving UIs or CDAs
• May truncate in UI, impose header-size limits, etc.
—–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
What this means for you
• If you’re talking directly “pure” MCP, there’s no ceiling ontool.name—it’s up to your client/server to decide.
• If you’re using a specific LLM API (e.g. OpenAI’s function-calling), refer to that API’s docs for the exact character-count and character-set rules.Still not sure which implementation you’re targeting? Let me know and I can point you to the exact limits! 🚀
- OpenAI’s function-calling API
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.