According to Anthropic’s overview of tool use, function calling lets Claude call predefined functions. Claude uses the user’s request and the tool description to decide whether to call a tool. It then returns a structured call for the application or Anthropic to execute.
The Model Context Protocol architecture overview defines MCP as a protocol for exchanging context. MCP servers can expose tools and also provide resources and prompts. An MCP client can retrieve the server’s tool list, make it available to the model, and execute a tool the model calls. A tool exposed through MCP and a tool call made by the model can be part of the same workflow.
How does direct function calling work?
In the direct approach Anthropic describes, the developer writes the schema for their tool, and the application executes the tool call. The tool definition is included in the API request. When Claude decides to make a call, it returns a tool_use block in its response. The application processes the call in that block and sends the result back to Claude as a tool_result.
In Anthropic’s weather example, the first request defines a tool called get_weather. The definition includes the name, description, and input_schema fields. Within input_schema, properties defines the inputs the tool accepts, and required specifies which inputs are mandatory. In the example, location is a required string input.
The tool_use block in Claude’s first response contains the tool name and its inputs. After running the weather lookup, the application adds the previous assistant response and the result to the conversation. The tool_use_id in the result block links the result to the corresponding tool call. After the second request, Claude uses the result to answer the user’s original question.
Anthropic distinguishes between client tools and server tools based on where they run. Developer-defined client tools run in the application. For some client tools whose schemas Anthropic defines, the application still executes the call and returns a tool_result. Server tools run on Anthropic’s infrastructure, and the application receives the result without handling execution in the usual workflow.
The term server tools has a different meaning from MCP server. Anthropic uses server tools to refer to tools that run on its own infrastructure. In MCP architecture, a server is a program that provides context to MCP clients. An MCP server can run locally or remotely.
Anthropic also describes a tool runner that handles the round trip for the developer. With this approach, the SDK executes the tools and sends the results back automatically. Developers can also include tools in a direct API call.
How are responsibilities divided in an MCP connection?
MCP architecture defines three roles: host, client, and server. The host is the AI application that manages one or more MCP clients. The client maintains a connection to an MCP server and retrieves context from it for the host to use. The server is the program that provides context to MCP clients.
According to the MCP architecture overview, the host creates a separate client for each MCP server it connects to. Each client maintains its own connection to the corresponding server. A host connected to multiple servers manages each connection through a separate client.
The protocol divides data exchange into two layers: the data layer and the transport layer. The data layer defines the structure and meaning of messages between the client and server. It covers tools, resources, prompts, and notifications. The transport layer handles communication details such as establishing connections and carrying messages.
MCP defines two transport mechanisms. The stdio transport uses standard input and output streams between local processes on the same machine. The Streamable HTTP transport uses HTTP POST for client-to-server messages and can use Server-Sent Events for streaming. Streamable HTTP supports HTTP authentication methods such as bearer tokens, API keys, and custom headers. MCP recommends OAuth for obtaining authentication tokens.
In the data layer, clients send requests to the server, and the server responds. The server can also request input from the client through Multi Round-Trip Requests. Notifications can be used when no response is needed. MCP uses the same JSON-RPC message format across transport mechanisms.
Tool definition and discovery
When using the Anthropic API directly, the developer includes the schema for their tool in the request’s tools parameter. In an MCP workflow, the client can discover the tools exposed by the server through a tools/list request. The MCP architecture overview explains that the list can be made available to the model and that a tool called by the model can be executed with tools/call.