Artificial Intelligence
MCP 도구 설계: 실용적인 접근법과 트레이드오프
When Model Context Protocol (MCP) tools underperform, the cause is rarely the protocol itself but the tool design. Many teams start by exposing an existing API as‑is and trusting the agent to figure out the rest. It is a natural way to extend APIs to agentic systems and generative AI coding tools. For straightforward use cases, it can work. But often it does not.
You must design your tools for how large language models (LLMs) and agentic systems work. Without this, you risk failed tool calls, wrong parameter values, and retries that waste context and degrade performance. In this post, we show where MCP tool design goes wrong and how to fix it with practical context engineering approaches.
Two problems are behind most of these failures. The first is bloat. Tool definitions load into the LLM’s context on every call, whether the tool is used or not. Multiple connected MCP servers can consume significant context before the user has asked a single question. As context fills, an LLM’s ability to reason can degrade and cause the session to become less productive.
The second is confusion. As reasoning degrades, the LLM makes poorer choices, calls the wrong tool and chooses incorrect parameters. Subsequent retries compound the issue by further contributing to bloat. Semantic similarity between tools, too many options, and ambiguous naming also contribute to confusion. A common solution is to enrich the tool descriptions with clearer definitions, natural language mappings, and usage examples. This does help with confusion. But everything added risks worsening bloat and compounding the very issue you are working to solve.
This pattern is common. Your agent makes unexpected choices, the context fills sooner than expected, and your session quickly becomes less useful. Addressing bloat and confusion is a context engineering problem. Context engineering shapes what the LLM sees and when it sees it, so the model produces better results. Improving one, or both, of these is a complex balancing act.
The following sections explore approaches and tradeoffs to address these issues. To make them concrete, we built several examples that expose a simulated K‑12 content search API using the MCP protocol. You will run them locally and interact with them using Kiro CLI to compare the differences yourself.
Approaches and tradeoffs
The approaches we share address these issues at the tool level. Some shape what the LLM sees or when it sees it. Others change how tools are structured. As you apply them, you need to understand how they impact bloat and confusion to find the right balance between the two.
Descriptions and responses
The natural first step to fixing MCP tool behavior is to improve the descriptions. A reliable way to reduce confusion is to clarify what values mean, how natural language maps to them, and what the tool is for. But take it too far, and you quickly add to bloat. Context and cost can grow quickly when many MCP servers are loaded into a client.
What the tool returns shapes behavior too. A tool that returns 50 fields per result fills context quickly. If 5 are sufficient for a decision, default the response to those fields and provide a separate option to request a detailed view. Shifting to an on‑demand approach for detailed output cuts response tokens by roughly two‑thirds, according to Anthropic’s research.
Proper error messages are another way to improve efficiency. When a tool call fails, helpful errors can steer the next attempt. A response that says “search requires 2 or more terms in query” tells the LLM exactly what to change. A response that returns only “no results” gives it nothing, causing the model to either give up or keep guessing.
Schema constraints
Where descriptions and proper errors guide the LLM toward correct values, schema constraints like enums and default values can remove the guesswork entirely. Consider the following to address common schema issues:
- Rename parameters to match how the LLM might understand the domain, not how your database labels its columns.
- A parameter called
resource_classwith values like ‘Student Resource’ or ‘Teacher Support’ is clearer for the LLM. Acontent_bucketcolumn requires the LLM to know an internal convention.
- A parameter called
- Set defaults to the most common values so the LLM only needs to specify what varies.
- Constrain finite‑value fields with enums so the schema itself tells the LLM what is valid.
- Drop fields that are rarely used or that the LLM cannot use well.
- AWS Prescriptive Guidance for MCP Strategies recommends keeping tool parameter counts around eight or fewer.
Restructuring tools and on‑demand context
Splitting a multi‑purpose tool into several specific tools provides clarity to the model and gives more granular results. A lazy loading discovery tool is one example. You can remove complex tool descriptions from the always‑loaded context and provide a separate tool for on‑demand retrieval. The LLM only retrieves this context when the task requires it. This keeps context lean and focused. Anthropic’s Tool Search Tool and Amazon Bedrock AgentCore Gateway show these concepts applied at scale. Anthropic reports up to 85% token reduction by loading tool definitions only when relevant.
Skills are another example of lazy loading, but implemented client side. These local files contain useful context for the tool but are only read into context when relevant. This reduces the effort to implement and distribute them. But there is no guarantee that the skill loads when needed or remains unchanged once installed.
Server‑side inference
Context engineering is challenging when you do not control which model will interpret your instructions. And once deployed, you may not control which LLM calls your MCP tools. A description tuned against one model might confuse another. Fully testing all the potential models a client might use is unrealistic.
One way to address this is to add an introspection tool that directly calls an external LLM. The client uses natural language to query your introspection tool and gets targeted instructions for using the other tools. Because you choose the model, you can properly prompt‑engineer this tool and test with golden queries. The client LLM still makes the final tool call, but your LLM interprets the need and provides correct values. Because the use case is focused, a smaller, faster model handles this task well and keeps costs reasonable at scale.
Agentic tools
When you need accuracy and full control, the next logical progression is to back your entire MCP server with an agent of your own. The introspection example handles a single interpretation step, but an agentic tool handles the entire interaction. The tools become natural language endpoints to the client. It states what it needs, and your agent does the rest. The other techniques covered still apply. The tradeoffs are yours to own completely, but as with introspection, you can fully engineer the behavior with the model of your choice.
The next section walks through working code that applies these approaches against the same backend and test queries, so you can compare their behavior directly.
Walkthrough
Each of the 6 versions wraps the same simulated K‑12 content search backend with a different MCP tool design. The backend has 14 filterable fields (subject, grade, format, standards alignment, language, resource class, and others) with controlled vocabularies. The challenge for the LLM is bridging the gap between how a teacher phrases a request and the exact values those fields accept. V1 starts with the raw passthrough that leaves this gap open. Each later version closes it differently.
Prerequisites
You need the following to run the sample code:
- Python 3.10+.
- SQLite (included with Python).
- Kiro (free tier available) or another MCP client.
- AWS account with Amazon Bedrock model access (V5 and V6 only): Amazon Nova 2 Lite and Anthropic’s Claude Sonnet 4.6.
Clone the sample code repository and follow the repository README for detailed prerequisites, installation, and server startup instructions. The walkthrough that follows assumes all six versions are running.
No infrastructure is deployed to AWS. You run all code locally. Inference calls to Amazon Bedrock are the only cost aside from your coding client. See Amazon Bedrock pricing for current rates.
This walkthrough assumes you are using Kiro and have run python scripts/setup_agents.py from the repository.
Test queries
These queries return real results from the sample database. Try them against each version:
- “Find me a quiz on fractions for my 7th graders.”
- “Do you have any lessons for teaching Spanish in middle school?”
- “I need TEKS‑aligned content for kids working on dividing in middle school.”
- “What types of content can I search for?”
- “Can I get details on n‑sc‑1096?”