life is too short for a diary




Reading - Agent Tools & Interoperability with MCP

Tags: reading mcp

Author
Written by: Tushar Sharma
Featured image for Reading - Agent Tools & Interoperability with MCP

Reading - Agent Tools & Interoperability with MCP1.

What's a tool

A tool is an external function or service that a language model can invoke at runtime to perform actions beyond its static training data.

OpenAI introduced function calling (circa mid-2023), which allows models to invoke external code. Modern tools are built on top of this function-calling capability.

Tool definition

A tool definition is a contract between the model and the client. This contract must include:

  1. a clear, unambiguous function name
  2. a descriptive docstring explaining what the tool does and when it should be used
  3. a strictly typed schema for input arguments

Example:

N × M Integration Problem

Consider a system with N AI models and M tools. Without standardization, each model requires a custom integration for each tool—resulting in N × M point-to-point connectors.

This quickly becomes unmanageable as both models and tools scale.

LSP

Before LSP, each code editor needed a separate plugin for each programming language. With 10 editors and 10 languages, that meant 100 plugins.

Microsoft introduced the Language Server Protocol (LSP). It provided:

MCP

MCP follows a similar architectural pattern to LSP. It provides:

Tool discovery example:

Tool Invocation

User query: “What’s the weather in New York?” The LLM decides to call get_weather(city="NY").

The server executes the function and returns the result, which the client feeds back into the model’s context.

Sampling

Sometimes a tool needs LLM assistance to complete its task—for example, summarizing a large document before returning a result.

Flow:

This keeps the server lightweight while still leveraging model intelligence.

Elicitation (Tool → Human)

When a tool lacks critical information—such as confirmation for a destructive action—it can elicit input from a human operator.

Example:

Best Practices for Designing Agent Tools

Describe intent, not implementation Prefer: “Create a high-priority bug ticket in Jira” Avoid: “POST to /rest/api/3/issue with JSON payload…”

Granularity matters Each tool should perform one atomic action. Compose complex workflows by chaining simple tools.

Minimize output payloads Never return megabytes of raw data to the LLM. If output is large:

Validate inputs strictly Enforce type and domain constraints (e.g., brightness ∈ [0,100]) to prevent runtime errors.

Idempotency & safety Design tools to be safe on retries (e.g., idempotency keys for financial or destructive operations).

References


comments powered by Disqus