Your Sunday, upgraded. Free live AI class · 5 PM ISTReserve your seat
AGENTS & AUTOMATION

Design an MCP Tool with Narrow Inputs and Clear Errors

A Model Context Protocol tool that accepts anything and returns raw errors is hard for a model to use safely. Narrow inputs, precise descriptions and actionable error messages make tools reliable.

On this page

The core idea

The Model Context Protocol lets an AI application connect to external servers that expose capabilities such as tools, resources and prompts. A tool has a name, a description and an input schema. The model chooses tools and fills in arguments based only on that information, so the description and schema are part of the interface, not documentation added later. Narrow, well-described tools are easier for a model to call correctly and easier for you to secure, because each one can do only a limited set of things.

A practical approach

Step 1

Design each tool around one task, such as search_courses or get_learner_progress, rather than a general run_query tool.

Step 2

Define a strict input schema: required fields, enumerations for fixed choices, formats for dates and identifiers, and limits on sizes.

Step 3

Write the description for a model that has never seen your system: what the tool does, when to use it and what it returns.

Step 4

Return errors that explain how to recover, such as 'course_id must be a numeric ID; use search_courses to find it', rather than stack traces.

Step 5

Enforce permissions on the server for every call. Never rely on the model to respect limits written only in the description.

Worked example

A team exposes its learning database through one MCP tool that accepts SQL. The model sometimes writes queries against tables it should not read, and errors show raw database messages. Replacing it with three tools, search_courses with a query and limit, get_course with a course_id and list_enrolments scoped to the signed-in user, makes calls accurate and keeps data access inside rules enforced by the server.

A mistake to avoid

Do not expose destructive actions, such as deleting or paying, as tools without a confirmation step in the host application. Tool descriptions and annotations are hints, not security controls.

Try it yourself

Write the name, description and input schema for two tools that would let an assistant answer questions about your course catalogue. Ask a colleague to read only those definitions and explain when they would call each tool.

Your implementation checklist

  • Each tool performs one clearly named task
  • Input schemas are strict and limited
  • Descriptions explain when and how to use the tool
  • Errors tell the model how to recover
  • Permissions are enforced by the server on every call

Share or cite this guide

Innovate with Ajay Editorial (2026-10-07). Design an MCP Tool with Narrow Inputs and Clear Errors. https://innovatewithajay.com/blogs/design-an-mcp-tool-with-narrow-inputs

Editorial approach, sources and corrections

YOUR NEXT CHAPTER

You have the curiosity.
Let’s turn it into capability.

Start with a practical workshop or bring a specific question to Ajay.

Chat with Ajay