Improving Agent Tool Accuracy: MCP Design Techniques Explained

    This article explains why most tool-calling failures come from interface design rather than model capability, and how to fix them. It covers choosing the right tool granularity, writing unambiguous descriptions and parameter structures, designing return payloads and error feedback that agents can act on, and managing context-window cost. A practical checklist is included for evaluating tool contracts. The principles apply to MCP and to tool integration in general.

    1. Starting Point: Treat Tools as the Agent’s User Interface

    Most tool-calling failures are not caused by limited model capability. They come from interfaces still designed for human developers. Traditional APIs assume the user reads documentation, understands the business context, and can read a stack trace and debug code after an error. An agent is a completely different kind of user: it does not browse documentation on its own, it is poor at filling in implicit assumptions from sparse context, and every call starts almost from scratch in terms of understanding what the tool does.

    So the design goal shifts from “wrapping existing capability” to “teaching the agent how to interact with the world.” A practical test: if only people on your own team can understand a tool description, the tool is effectively unusable for an agent.

    The agent’s capability profile defines the design boundaries:

    • Strengths: natural language understanding, intent recognition, summarizing across information fragments, composing multi-step plans.
    • Weaknesses: precise numerical computation, stable memory across long contexts, guessing the right parameters from vague descriptions.
    • Visibility: it can only see the exposed parameter structure and text descriptions, never the internal implementation.
    • Resource constraints: the context window is limited, and as history fills it up, tool-selection accuracy drops noticeably.

    These four points run through every design decision in this article. Note that the starting point here is the mainstream protocol form for connecting agents to external capabilities, but the conclusions apply equally to any tool integration approach.

    2. Granularity: One Tool, One Verifiable Intent

    Granularity is the first variable that affects accuracy. A tool that is too coarse compresses several decisions into a single call, and the agent will frequently get parameter combinations wrong. A tool that is too fine makes the call chain longer, and any deviation in the middle gets amplified.

    The recommended unit of division is a “business intent that can be verified independently.” Three questions help decide: can the tool be named in one sentence of business language; can its success and failure be judged clearly; does it require the agent to make only one key decision. If a single call forces the agent to determine resource type, time window, and permission scope at the same time, it should usually be split.

    An illustrative structural comparison:

    1. # Too coarse: too many decision points, high chance of wrong calls
    2. create_task(resource_type, region, spec, schedule, retry_policy, owner, tags)
    3. # Reasonable granularity: single intent, self-explanatory parameters
    4. create_scheduled_task(task_name, execute_at, command)
    5. query_task_status(task_name)

    After the split, the agent handles one semantic unit per call, the value space for each parameter narrows, and locating errors becomes easier.

    3. Descriptions and Parameter Structure: Make Implicit Knowledge Explicit in the Contract

    The description and the structure are the only things an agent can rely on, so the goal of a description is not completeness but removing ambiguity. Reusable elements include: what problem the tool solves, under which preconditions it should be used, how it differs from adjacent tools at the boundary, and one short positive call example. Boundary notes matter especially, because they noticeably reduce hesitation such as “should I use the query tool or the statistics tool.”

    Three constraints for parameter design:

    1. Minimize required fields and provide sensible defaults for the rest, reducing failures caused by missing parameters.
    2. Express fields with restricted values as enums, avoiding the spelling and format drift that free text introduces.
    3. Declare units and formats explicitly for time, capacity, and identifier fields instead of relying on common sense to fill them in.
    1. query_usage(
    2. resource_id: string, # required, unique identifier of the target resource
    3. granularity: "minute"|"hour"|"day" = "hour", # enum, avoids free text
    4. duration: int = 24 # unit: hours, defaults to the last day
    5. )

    4. Return Structure and Error Feedback: Turn Failures into Actionable Information

    Return content serves two kinds of consumers at once: programmatic parsing and agent reasoning. A stable practice is to keep the top-level structure fixed, put business data under predictable keys, and add a short natural-language summary so the agent can decide the next step without expanding all the data.

    Error messages should not return only an error code. Effective feedback has three elements: what happened, why it failed, and what to try next. When a parameter is invalid, state the allowed range directly; when a dependent resource does not exist, point to which query tool to call first. This kind of feedback writes debugging experience into the contract and gives the agent the ability to correct itself.

    5. Context Cost: Manage the Window as a Limited Budget

    Context is a consumed resource, not a free cache. Returning large blocks of structured data at high frequency quickly crowds out the window and degrades the quality of later tool choices. Controls include: paginate by default and cap the page size, project fields on demand, offer two levels of view (summary and detail) for long text, and state stable enums and explanations once in the tool description rather than returning them repeatedly.

    Engineering-wise, the tool set can also be grouped by scenario, exposing only the minimal subset the current task needs. As the number of tools grows, selection errors tend to appear before invocation errors, so narrowing the candidate set is the cheapest optimization.

    6. Implementation Checklist

    • Does each tool map to exactly one verifiable intent, and is the name self-explanatory?
    • Are required parameters reduced to the minimum, and are restricted values expressed as enums?
    • Are units, formats, and defaults declared explicitly in the structure?
    • Does the error return include the cause and an actionable next step?
    • Is the response paginated and projected, with a summary view available?
    • Is the tool set narrowed per scenario instead of exposing too many candidates at once?

    Applied at the level of the interface contract, these principles turn a tool from “a wrapper around capability” into “an interface the agent can understand.” In agent engineering practice on platforms such as Baidu AI Cloud, this kind of refinement—centered on description quality, structural constraints, and a feedback loop—usually delivers more consistent gains than switching models. The next article will use concrete scenarios to discuss multi-tool coordination and evaluation methods.