This guide outlines best practices for converting standard APIs into Model Context Protocol (MCP) tools for use with AI agents. Proper tool design helps ensure LLMs can understand and safely use your APIs.
By following these best practices, you can build safer, more intuitive MCP tools that enhance the capabilities of LLM agents.
Be selective:
Avoid exposing every endpoint as a tool. LLM clients perform better with a limited number of well-defined tools, and providers often impose tool limits.
Prioritize safety:
Do not expose PUT or DELETE endpoints unless absolutely necessary. LLMs are non-deterministic and could unintentionally alter or damage systems or databases.
Focus on data retrieval:
Prefer GET endpoints that return data safely and predictably.
Emphasize meaningful workflows:
Expose endpoints that reflect clear, goal-oriented tasks. Tools with focused actions are easier for agents to understand and use effectively.