Skip to main content

Module protocol

Module protocol 

Source
Expand description

Reusable protocol conversion helpers between loose JSON/descriptor shapes and concrete rmcp::model types.

Any inbound MCP server ends up doing this conversion at least twice: once for its own natively-defined tools (usually stored as plain JSON schema documents) and once for anything it re-projects from elsewhere (an upstream catalog, a provider registry, a gateway route). This module owns the generic half of both conversions; callers own the descriptor/schema source.

Functionsยง

prompt_from_descriptor
Build an [rmcp::model::Prompt] from a name and optional description, with no declared arguments.
resource_from_descriptor
Build an [rmcp::model::Resource] from a resolved URI and display name.
tool_from_descriptor
Build an [rmcp::model::Tool] from loose descriptor fields, defaulting a missing or non-object input schema to an empty JSON object schema and dropping a non-object output schema rather than failing.
tool_from_json_definition
Convert an untyped MCP tool-definition JSON object ({name, description, inputSchema, outputSchema}) into an [rmcp::model::Tool].