← Back to ToolBench
Server Capabilities
Tools
Let servers expose callable functions to LLM clients
What it does
Tools are the primary way an MCP server exposes functionality. Each tool has a name, description, and a JSON Schema defining its input parameters. Clients discover available tools via tools/list, then invoke them with tools/call. The server executes the function and returns structured results. Tools enable LLMs to take actions in the real world: reading databases, calling APIs, manipulating files, and more.
How it works
Example implementation
server.tool("get_weather", { city: z.string() }, async ({ city }) => {
const data = await fetchWeather(city);
return { content: [{ type: "text", text: JSON.stringify(data) }] };
});