Expand description
Shared MCP schemas, tool registries, and rmcp server glue for
component-shape integrations.
This crate owns protocol-level building blocks, schema-paired value decoding, and Koruma domain validation with common metadata/error helpers. Applications choose domain rules and own authorization and handler contracts.
Re-exports§
pub use koruma_core;pub use rmcp;pub use serde;pub use serde_json;
Structs§
- McpAny
- Explicit unconstrained JSON value for typed MCP inputs.
- McpArguments
- Owning decoder for MCP tool argument objects.
- McpIcon
- A URL pointing to an icon resource or a base64-encoded data URI.
- McpInput
- Shape-owned metadata for model-controlled MCP input.
- McpJson
Resource Spec - Validated static JSON resource ready to register on an
McpServer. - McpPrompt
Argument - Describes an argument that a prompt can accept (spec
PromptArgument). - McpPrompt
Message - A message returned as part of a prompt (spec
PromptMessage). - McpPrompt
Result - McpRange
- Typed
{ "min": ..., "max": ... }range argument used by MCP tools. - McpResource
Result - Result containing the contents of a read resource
- McpSchema
- Typed JSON Schema value used by generated MCP tool metadata.
- McpSchema
Number - JSON number used by numeric JSON Schema keywords.
- McpServer
- In-process MCP server that owns registered tools, resources, and prompts.
- McpServer
Builder - Builder for composing generated MCP server registrars.
- McpStdio
Smoke Client - Minimal newline-delimited JSON-RPC MCP client for subprocess smoke tests.
- McpTool
Annotations - Additional properties describing a Tool to clients.
- McpTool
Call - Typed MCP tool call payload passed to registered handlers.
- McpTool
Icon - Static icon metadata for an MCP tool definition.
- McpTool
Metadata - Optional application-facing metadata for a generated MCP tool.
- McpTool
Registry - A clonable collection of MCP tool definitions and in-process handlers.
- McpTyped
Tool - Tool definition paired with the typed MCP input it was built from.
- McpValidation
Issue - Structured validation failure returned in MCP error details and snapshots.
- McpValidation
Param - One builder argument captured from a generated validator chain.
- McpValidation
Rule - Static validator metadata attached to an MCP-visible field or filter.
- Process
Status - Process status attached to stdio smoke failures.
- Prompt
Definition - A prompt or prompt template that the server offers (spec
Prompt). - Resource
Definition - A known resource that the server is capable of reading (spec
Resource). - Resource
Template Definition - A template description for resources available on the server (spec
ResourceTemplate). - Stderr
Snapshot - Captured stderr attached to stdio smoke failures.
- Tool
Call Result - The result of a tool call operation.
- Tool
Definition - A tool that can be used by a model.
Enums§
- Content
Block - Unified content block union (spec
ContentBlock). - McpAdditional
Properties - Value accepted by the JSON Schema
additionalPropertieskeyword. - McpIcon
Theme - Icon themes supported by the MCP specification
- McpInput
Shape - Framework-neutral shape of structured MCP input accepted by a component.
- McpPrimitive
Kind - Primitive value kinds a component shape can expose to model-controlled tools.
- McpRange
Bound Kind - Primitive kinds that can be used as
{ "min": ..., "max": ... }MCP range bounds. - McpResource
Contents - The contents of a specific resource or sub-resource.
- McpRole
- Represents the role of a participant in a conversation or message exchange.
- McpSchema
Type - Primitive JSON Schema root types supported by typed schema builders.
- McpStdio
Smoke Error - Error returned by the newline-delimited JSON-RPC stdio smoke client.
- McpString
Format - Standard string formats emitted by component-shape MCP schemas.
- McpTool
Error - Typed setup, decoding, validation, and handler error used by MCP helpers.
- McpValidation
Scope - Where a generated MCP validation issue applies.
- McpValidation
Target - Koruma target selector recorded for an MCP validation rule.
- McpValidation
Type ArgMode - Type argument syntax used by a generated validator descriptor.
Constants§
- MCP_
PROTOCOL_ VERSION - MCP_
VALIDATION_ PARAMS_ NONE - Shared empty validation parameter slice for generated descriptors.
Traits§
- Component
Shape For - Marker that a component shape supports a value or field type.
- Component
Shape Metadata - Framework-neutral metadata published by a component shape.
- McpJson
Schema - JSON Schema metadata for typed MCP argument and result values.
- McpTool
Input - Typed MCP tool input decoded from a protocol argument object.
- McpTool
Value - Typed value used as one field inside an MCP tool argument object.
Functions§
- apply_
validation_ schema_ hints - Reflect supported literal validation parameters into a JSON Schema object.
- apply_
validation_ schema_ metadata - Attach generated validation metadata and supported JSON Schema hints.
- array_
schema - Build an array schema for items of
item_schema. - ensure_
json_ resource_ specs_ available - Ensure generated JSON resource URIs are unique and not already registered.
- ensure_
json_ resource_ specs_ distinct - Ensure generated JSON resource URIs are unique within one batch.
- json_
resource_ definitions - Return resource definitions for a distinct set of generated JSON resources.
- json_
resource_ result - Encode a JSON value as a pretty-printed
application/jsonresource result. - koruma_
validation_ error - Convert a Koruma validation error into structured MCP error details.
- mcp_
input_ descriptor_ value - Build a compact JSON descriptor for component-shape MCP input metadata.
- nullable_
schema - object_
schema - Build a closed object schema from properties and required field names.
- prompt_
definition - Build and validate an MCP prompt definition.
- range_
schema - register_
json_ resource_ specs - Register generated JSON resources, failing if any URI is duplicated.
- register_
json_ resource_ specs_ if_ missing - Register generated JSON resources unless every URI is already present.
- resource_
definition - Build and validate a concrete MCP resource definition.
- resource_
template_ definition - Build and validate an MCP resource template definition.
- schema_
allows_ null - schema_
for_ input - schema_
for_ primitive - schema_
for_ range_ bound - schema_
object - Converts an MCP schema wrapper into a JSON object.
- serialize_
handler_ response - serialize_
response_ value - string_
keyed_ object_ schema - Build an object schema whose string keys all use
value_schema. - text_
prompt_ result - Build a prompt result containing one user text message.
- text_
resource_ result - Build a text resource result with an explicit MIME type.
- tool_
call_ structured_ content - Return a tool call’s protocol-level
structuredContent, if present. - tool_
definition - Build and validate an MCP tool definition.
- tool_
definition_ for_ input - Build and validate a typed MCP tool definition from its input type.
- tool_
definition_ for_ input_ with_ annotations - Build and validate a typed MCP tool definition with tool annotations.
- tool_
definition_ for_ input_ with_ metadata - Build and validate a typed MCP tool definition from generated metadata.
- tool_
definition_ with_ annotations - Build and validate an MCP tool definition with tool annotations.
- tool_
definition_ with_ metadata - Build and validate an MCP tool definition from generated metadata.
- tool_
error_ result - Build an MCP error result for a plain message.
- tool_
error_ result_ for - Build an MCP error result with machine-readable
structured_content.error. - tool_
name - tool_
structured_ result - tuple_
schema - Build a fixed-length tuple schema.
- unique_
array_ schema - Build a unique-array schema for items of
item_schema. - validate_
koruma - Execute Koruma domain rules and translate a failure into an MCP error.
- validate_
prompt_ definition - Validate an MCP prompt definition accepted by this shared server.
- validate_
resource_ definition - Validate a concrete MCP resource definition accepted by this shared server.
- validate_
resource_ template - Validate an MCP resource template definition accepted by this shared server.
- validate_
tool_ annotations - Validate MCP tool annotations accepted by generated integrations.
- validate_
tool_ definition - Validate an MCP tool definition accepted by this shared server.
- validate_
tool_ metadata_ text - Validate human-readable MCP tool metadata text.
- validate_
tool_ name - Validate an MCP tool name accepted by generated integrations.
- validation_
issues_ error - Convert validation issues into a structured MCP validation error.
Type Aliases§
Derive Macros§
- McpJson
Schema - Derive JSON Schema metadata for structs, transparent newtypes, and fieldless enums used in MCP tool schemas.
- McpTool
Input - Derive a top-level MCP input schema and strict MCP argument decoding for a named tool input struct.