Skip to main content

Module tool

Module tool 

Source
Expand description

Writing and registering MCP tools.

A tool registered here is offered by every MCP server in the process, alongside the built-in bn_* tools. Implement McpTool and pass it to register_mcp_tool. With the schemars feature, implement TypedMcpTool instead and pass it to register_typed_mcp_tool. The input schema and argument parsing then come from the arguments type.

Structs§

CoreMcpTool
A tool in the tool registry.
McpAddress
An address expression string, evaluated against the call’s binary view with McpAddress::resolve.
McpNonEmptyString
A string argument that rejects an empty string.
McpToolAnnotations
Hints a client uses to decide how to present a tool and whether to ask before running it.
McpToolCall
One invocation of a tool. The binary view and cancellation state are only available while the tool is running.
McpToolDefinition
McpToolError
An error result with a machine-readable code.
McpToolInfo
Everything about a tool except its input schema.
McpToolResult

Enums§

McpIntegerExpression
An unsigned integer, or an expression string evaluated against the call’s binary view with McpIntegerExpression::resolve.
McpToolScope

Traits§

McpTool
A tool with a hand-written input schema that receives its arguments as JSON.

Functions§

empty_input_schema
A JSON Schema object for a tool that takes no arguments.
register_mcp_tool
Registers a tool for the life of the process. Returns None when the definition is invalid or its name is already registered, or when a string in it contains a NUL.