Skip to main content

Crate component_shape_mcp

Crate component_shape_mcp 

Source
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.
McpJsonResourceSpec
Validated static JSON resource ready to register on an McpServer.
McpPromptArgument
Describes an argument that a prompt can accept (spec PromptArgument).
McpPromptMessage
A message returned as part of a prompt (spec PromptMessage).
McpPromptResult
McpRange
Typed { "min": ..., "max": ... } range argument used by MCP tools.
McpResourceResult
Result containing the contents of a read resource
McpSchema
Typed JSON Schema value used by generated MCP tool metadata.
McpSchemaNumber
JSON number used by numeric JSON Schema keywords.
McpServer
In-process MCP server that owns registered tools, resources, and prompts.
McpServerBuilder
Builder for composing generated MCP server registrars.
McpStdioSmokeClient
Minimal newline-delimited JSON-RPC MCP client for subprocess smoke tests.
McpToolAnnotations
Additional properties describing a Tool to clients.
McpToolCall
Typed MCP tool call payload passed to registered handlers.
McpToolIcon
Static icon metadata for an MCP tool definition.
McpToolMetadata
Optional application-facing metadata for a generated MCP tool.
McpToolRegistry
A clonable collection of MCP tool definitions and in-process handlers.
McpTypedTool
Tool definition paired with the typed MCP input it was built from.
McpValidationIssue
Structured validation failure returned in MCP error details and snapshots.
McpValidationParam
One builder argument captured from a generated validator chain.
McpValidationRule
Static validator metadata attached to an MCP-visible field or filter.
ProcessStatus
Process status attached to stdio smoke failures.
PromptDefinition
A prompt or prompt template that the server offers (spec Prompt).
ResourceDefinition
A known resource that the server is capable of reading (spec Resource).
ResourceTemplateDefinition
A template description for resources available on the server (spec ResourceTemplate).
StderrSnapshot
Captured stderr attached to stdio smoke failures.
ToolCallResult
The result of a tool call operation.
ToolDefinition
A tool that can be used by a model.

Enums§

ContentBlock
Unified content block union (spec ContentBlock).
McpAdditionalProperties
Value accepted by the JSON Schema additionalProperties keyword.
McpIconTheme
Icon themes supported by the MCP specification
McpInputShape
Framework-neutral shape of structured MCP input accepted by a component.
McpPrimitiveKind
Primitive value kinds a component shape can expose to model-controlled tools.
McpRangeBoundKind
Primitive kinds that can be used as { "min": ..., "max": ... } MCP range bounds.
McpResourceContents
The contents of a specific resource or sub-resource.
McpRole
Represents the role of a participant in a conversation or message exchange.
McpSchemaType
Primitive JSON Schema root types supported by typed schema builders.
McpStdioSmokeError
Error returned by the newline-delimited JSON-RPC stdio smoke client.
McpStringFormat
Standard string formats emitted by component-shape MCP schemas.
McpToolError
Typed setup, decoding, validation, and handler error used by MCP helpers.
McpValidationScope
Where a generated MCP validation issue applies.
McpValidationTarget
Koruma target selector recorded for an MCP validation rule.
McpValidationTypeArgMode
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§

ComponentShapeFor
Marker that a component shape supports a value or field type.
ComponentShapeMetadata
Framework-neutral metadata published by a component shape.
McpJsonSchema
JSON Schema metadata for typed MCP argument and result values.
McpToolInput
Typed MCP tool input decoded from a protocol argument object.
McpToolValue
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/json resource 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§

McpSchemaFn
McpSchemaProperties
McpToolArguments
ServeStdioResult

Derive Macros§

McpJsonSchema
Derive JSON Schema metadata for structs, transparent newtypes, and fieldless enums used in MCP tool schemas.
McpToolInput
Derive a top-level MCP input schema and strict MCP argument decoding for a named tool input struct.