# MCP from the Tool Author's View — AI Agents and Tool Use

Source: https://www.geekswithgeeks.com/en/ai-agents-mcp/multi-mcp

> Understand how the Model Context Protocol lets one tool server work with many agents.

## Write the tool once

Without a standard, every agent or app needs its own adapter for each tool. The **Model Context Protocol (MCP)** defines how a client discovers (`tools/list`) and calls (`tools/call`) tools on a **server**, so one server can serve many hosts. Everything from this course still applies: write clear schemas and descriptions, return helpful errors, keep write tools idempotent, and limit what the server's credentials can do.

## Our tools as an MCP server

With the official Python SDK, a decorated function becomes a tool and its schema comes from the type hints. Install with `pip install "mcp[cli]"`. Details are in the dedicated MCP course.

```python
from mcp.server.fastmcp import FastMCP

mcp = FastMCP("accounts")

@mcp.tool()
def get_balance(account_id: int) -> str:
    """Return the current balance of one account. Read-only."""
    return f"account {account_id}: 1500"

if __name__ == "__main__":
    mcp.run()
```

## Version your tool servers

When many agents depend on one tool server, changing a tool name or schema can break all of them. Add new tools instead of renaming, and announce removals ahead of time.

**Quiz:** What is the main benefit of exposing tools through MCP?

- [x] One tool server can work with many compatible agents and apps
- [ ] Tools no longer need descriptions
- [ ] It removes the need for security
- [ ] It makes tools free

*Answer:* One tool server can work with many compatible agents and apps. A shared protocol replaces many custom adapters with one server implementation.
