new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

MCP · Building servers and clients · all subjects

tools

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Listing tools in the Python client

`tool_list = await client.list_tools()` returns an object with a `.tools` list. Each tool exposes `tool.name`, `tool.description` and `tool.input_schema` (snake_case in the Python SDK), which map onto the Anthropic API tool fields `name`, `description`, `input_schema`.

CallToolResult content is a list of blocks, narrow to TextContent

`await client.call_tool(tool_name, tool_args)` returns a `CallToolResult` whose `content` is a list of blocks. Client code must narrow to text blocks before reading text, e.g. `"\n".join(block.text for block in result.content if isinstance(block, TextContent))` where `TextContent` is imported from `mcp_types`.

Tool name validation should follow the spec format

Tool names can be validated against the format specified in the MCP specification (server/tools#tool-names). If a tool name conforms to that specified format, it should not fail validation by an MCP client — a mismatch here is a common source of a server working in one client but not another.

Rust: tool fields for model conversion

An rmcp `Tool` exposes `tool.name`, `tool.description` (an Option) and `tool.input_schema` (a JSON object behind a reference), which must be converted into the model API's tool definition — MCP and model APIs describe tools with similar information but different types, so an explicit conversion function is needed.

Give your agent this brain