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§
- Core
McpTool - A tool in the tool registry.
- McpAddress
- An address expression string, evaluated against the call’s binary view with
McpAddress::resolve. - McpNon
Empty String - A string argument that rejects an empty string.
- McpTool
Annotations - Hints a client uses to decide how to present a tool and whether to ask before running it.
- McpTool
Call - One invocation of a tool. The binary view and cancellation state are only available while the tool is running.
- McpTool
Definition - McpTool
Error - An error result with a machine-readable code.
- McpTool
Info - Everything about a tool except its input schema.
- McpTool
Result
Enums§
- McpInteger
Expression - An unsigned integer, or an expression string evaluated against the call’s binary view with
McpIntegerExpression::resolve. - McpTool
Scope
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
Nonewhen the definition is invalid or its name is already registered, or when a string in it contains a NUL.