Is your feature request related to a problem? Please describe.
Currently, the ruby-sdk does not support the _meta property for tool definitions, which is part of the MCP specification. The TypeScript SDK and other official SDKs include support for _meta fields, allowing clients and servers to attach additional metadata to their interactions. Without this support in the Ruby SDK, Ruby-based MCP servers cannot provide or consume metadata that may be critical for certain protocol extensions or implementation-specific features.
Describe the solution you'd like
Add support for the _meta property in tool definitions within the ruby-sdk, following the MCP specification guidelines:
- Update the
MCP::Tool class to accept an optional _meta parameter in both class-based and define method approaches - Include
_meta in the tool schema serialization when responding to tools/list requests - Validate
_meta keys according to the specification format rules (prefix/name segments) - Pass through
_meta in tool responses where appropriate
Implementation should follow the pattern used in the TypeScript SDK where _meta is an optional field in tool definitions.
Example usage:
classMyTool < MCP::Tooldescription"Example tool with metadata"input_schema(properties: {message: {type: "string"}},required: ["message"])# New _meta supportmeta({"example.com/priority"=>"high","internal-id"=>"tool-123"})defself.call(message:,server_context:)MCP::Tool::Response.new([{type: "text",text: "OK"}])endend# Or with define methodtool=MCP::Tool.define(name: "my_tool",description: "Example tool",_meta: {"example.com/priority"=>"high"})do |args,server_context|
MCP::Tool::Response.new([{type: "text",text: "OK"}])endDescribe alternatives you've considered
Workaround via custom annotations: While the SDK supports custom annotations, these don't follow the MCP specification for _meta and aren't interoperable with other MCP implementations.
Fork and patch: Creating a custom fork of the ruby-sdk with _meta support, but this creates maintenance burden and diverges from the official SDK.
Wait for automatic generation: Since the TypeScript SDK already supports _meta, waiting for this to be ported might be an option, but proactive implementation would benefit Ruby users sooner.
Additional context
The _meta property is defined in the MCP specification ([source](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/draft/basic/index.mdx#general-fields)) as a reserved property for attaching metadata. The TypeScript SDK implementation in types.ts includes _meta as an optional field in tool definitions.
Key specification requirements for _meta:
- Keys must follow the format: optional prefix (with
/) + name - Prefixes use dot-separated labels ending with
/ - The
modelcontextprotocol.* and mcp.* prefixes are reserved - Names must begin/end with alphanumeric characters
This feature would bring the ruby-sdk to feature parity with other official SDKs and enable more sophisticated MCP implementations in Ruby.
Is your feature request related to a problem? Please describe.
Currently, the ruby-sdk does not support the
_metaproperty for tool definitions, which is part of the MCP specification. The TypeScript SDK and other official SDKs include support for_metafields, allowing clients and servers to attach additional metadata to their interactions. Without this support in the Ruby SDK, Ruby-based MCP servers cannot provide or consume metadata that may be critical for certain protocol extensions or implementation-specific features.Describe the solution you'd like
Add support for the
_metaproperty in tool definitions within the ruby-sdk, following the MCP specification guidelines:MCP::Toolclass to accept an optional_metaparameter in both class-based anddefinemethod approaches_metain the tool schema serialization when responding totools/listrequests_metakeys according to the specification format rules (prefix/name segments)_metain tool responses where appropriateImplementation should follow the pattern used in the TypeScript SDK where
_metais an optional field in tool definitions.Example usage:
Describe alternatives you've considered
Workaround via custom annotations: While the SDK supports custom annotations, these don't follow the MCP specification for
_metaand aren't interoperable with other MCP implementations.Fork and patch: Creating a custom fork of the ruby-sdk with
_metasupport, but this creates maintenance burden and diverges from the official SDK.Wait for automatic generation: Since the TypeScript SDK already supports
_meta, waiting for this to be ported might be an option, but proactive implementation would benefit Ruby users sooner.Additional context
The
_metaproperty is defined in the MCP specification ([source](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/draft/basic/index.mdx#general-fields)) as a reserved property for attaching metadata. The TypeScript SDK implementation intypes.tsincludes_metaas an optional field in tool definitions.Key specification requirements for
_meta:/) + name/modelcontextprotocol.*andmcp.*prefixes are reservedThis feature would bring the ruby-sdk to feature parity with other official SDKs and enable more sophisticated MCP implementations in Ruby.