Commit graph ruby-sdk/README.md
Author SHA1 Message Date
Hiren Hiranandani
08a84c7320
Introduce stateless mode to allow for HA
- Create failing tests for `stateless` mode
- Implement `stateless` mode by turning of SSE in Streamable HTTP,
  making the interaction a standard HTTP Req/Resp
2025-11-04 15:26:12 -08:00
Koichi ITO
5b737eb9c3 [Docs] Extract release documentation to RELEASE.md
README is generally better kept focused on information that is most valuable to users.
For that reason, release procedures that are not relevant to end users have been moved to
a separate RELEASE.md file.
2025-11-04 11:13:39 +09:00
Koichi ITO
fb67a9b969 [Doc] Fix incorrect schema name
This PR fixes an incorrect schema name.

The test code already uses `items:`.
https://github.com/modelcontextprotocol/ruby-sdk/blob/v0.4.0/test/mcp/tool/output_schema_test.rb#L135-L141

Fixes #170.
2025-10-26 01:24:45 +09:00
Koichi ITO
ad87c8d805
Merge pull request #163 from dak2/add-client-prompts-support
Add `prompts/list` and `prompts/get` support to client
2025-10-19 02:24:36 +09:00
dak2
e88deb6b65 Add prompts/list and prompts/get support to client
This commit adds two new methods to `MCP::Client`:
- prompts: Lists available prompts from the server via `prompts/list`
- get_prompt: Retrieves a specific prompt by name via `prompts/get`

Both methods follow the same pattern as the existing resources support,
including comprehensive test coverage and README documentation updates.

ref. https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/server/prompts.mdx#protocol-messages
2025-10-15 13:16:41 +09:00
Koichi ITO
f312695798
Merge pull request #153 from modelcontextprotocol/prompt-spec-compliance
fix `Prompt` type gaps with 2025-06-18 spec
2025-10-15 01:22:45 +09:00
Koichi ITO
93215f4d52 [Doc] Mention resources/list and resources/read in the README
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/160
2025-10-12 00:33:01 +09:00
Topher Bullock
a1dd3dd005 add _meta field to Prompt
> See [General fields: `_meta`](/specification/2025-06-18/basic/index#meta) for notes on `_meta` usage.

51e093b8eb/schema/2025-06-18/schema.ts (L680-L683)
2025-10-10 09:05:55 -04:00
Koichi ITO
a217f70d95 [Doc] Fix incorrect example code in README
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/33.

A `NameError` occurs because `MCP::Transports::HTTP` does not exist.
The correct constant is `MCP::Server::Transports::StreamableHTTPTransport`.
2025-10-09 11:44:58 +09:00
Koichi ITO
bee6eace22 Remove unnecessary transport requires
The transports are already required by `require 'mcp'`:
https://github.com/modelcontextprotocol/ruby-sdk/blob/v0.3.0/lib/mcp.rb#L16-L17
2025-10-07 14:10:48 +09:00
Topher Bullock
701f6faab6 add title field to prompt argument
`PromptArgument extends BaseMetadata`, which includes both name and
title
 - 51e093b8eb/schema/2025-06-18/schema.ts (L686-L698)
 - 51e093b8eb/schema/2025-06-18/schema.ts (L294-l309)
2025-10-06 09:35:42 -04:00
Koichi ITO
de1e833ae3
Merge pull request #144 from nilcolor/output_schema_arrays
Allow output schema to be array of objects
2025-09-28 03:17:09 +09:00
Anandaroop Roy
f7cf080cc0
Support structuredContent in tool response (#147) 2025-09-27 02:23:41 -04:00
Koichi ITO
99f90b8b31 Fix some typos
The `ModelContextProtocol` module name has been renamed to `MCP`,
and `define_protocol` appears to be a typo for `define_prompt`.
2025-09-25 18:06:34 +09:00
Alexey Blinov
4ee128ad67 Allow output schema to be array of objects
closes #142
2025-09-25 11:56:03 +05:00
Ateş Göral
cd4681351d
Merge branch 'main' into main 2025-09-13 17:11:23 -04:00
Ateş Göral
5c5f420f42
Merge pull request #122 from koic/add_validation_for_tool_annotation
Validate tool annotations value
2025-09-13 14:22:42 -04:00
Koichi ITO
dc28d696ec
Merge pull request #128 from koic/tweak_the_doc_of_transport_support_in_the_readme
[Docs] Tweak the doc of Transport Support in the README.md
2025-09-12 01:32:23 +09:00
Valentino Stoll
aad8e94530
Add Tool output_schema support with comprehensive validation
This commit implements optional JSON Schema validation for tool outputs according to the MCP specification:

- Add MCP::Tool::OutputSchema class mirroring InputSchema functionality
- Support output_schema in class definitions, Tool.define, and OutputSchema objects
- Include validate_result method for runtime validation
- Update MCP::Client::Tool to track output schemas
- Add comprehensive test coverage with 249 passing tests
- Update README with dedicated Tool Output Schemas section
- Follow MCP spec requirements for server/client validation
2025-09-11 11:12:27 -04:00
Koichi ITO
08048283e4 Validate tool annotations value
Tool annotations were introduced in the "2025-03-26" specification:

> Added comprehensive tool annotations for better describing tool behavior,
> like whether it is read-only or destructive (PR modelcontextprotocol/modelcontextprotocol#185)

https://modelcontextprotocol.io/specification/2025-03-26/changelog#major-changes

This means they are not supported in the "2024-11-05" specification,
so validation errors will be raised for `protocol_version: "2024-11-05"`.
2025-09-11 10:48:56 +09:00
Koichi ITO
0ab27063e7
Merge pull request #129 from koic/add_example_of_define_tool_and_define_protocol_to_read
[Doc] Add example of `define_tool` and `define_protocol`
2025-09-10 09:27:03 +09:00
Joey Cardosi
8b764428b1
Add basic HTTP client support with pluggable transports 2025-09-08 15:52:37 -05:00
Koichi ITO
e5bb17eafb [Doc] Add example of define_tool and define_protocol
This PR adds example of `define_tool` and `define_protocol`.
2025-09-06 10:58:24 +09:00
Koichi ITO
cc16639cc8 [Docs] Tweak the doc of Transport Support in the README.md
Follow-up to #33.

The order of appearance of Stdio and Streamable HTTP follows the specification:
https://modelcontextprotocol.io/specification/2025-06-18/basic/transports
2025-09-04 11:22:43 +09:00
Koichi ITO
02b546dcda [Docs] Document MCP::ResourceTemplate
This PR documents `MCP::ResourceTemplate`.

Resolves #88.
2025-08-31 00:20:53 +09:00
Koichi ITO
b982074daa
Merge pull request #119 from koic/add_title_to_server_info
Add `title` to `serverInfo`
2025-08-30 02:01:53 +09:00
Koichi ITO
da471a21b6
Merge pull request #118 from koic/add_default_value_to_tool_annotation
Set default values for `ToolAnnotations` hints
2025-08-29 16:21:31 +09:00
Koichi ITO
ef56280518 Add title to serverInfo
Follow-up to #109.

`title` has also been added to `serverInfo` and `clientInfo` by
https://github.com/modelcontextprotocol/modelcontextprotocol/pull/663.

Since `clientInfo` is not treated as product code, support is implemented only in `serverInfo`.

See also https://modelcontextprotocol.io/specification/2025-06-18/schema#implementation.
2025-08-29 14:36:39 +09:00
Koichi ITO
da4fd6410e [Docs] Add a tools/call example in README
This PR adds a `tools/call` example to make it clear how to call a tool from
the tool list obtained via `tools/list`.

Closes #110.
2025-08-29 13:46:33 +09:00
Koichi ITO
cae30547d2 Set default values for ToolAnnotations hints
According to the specification, `destructive_hint`, `idempotent_hint`, `open_world_hint`,
and `read_only_hint` of `ToolAnnotations` are optional with default values:
https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations

This PR sets their default values in accordance with the specification.

Additionally, for readability, the hints have been reordered to follow the specification.
2025-08-28 01:13:57 +09:00
Koichi ITO
f4228612a8
Merge pull request #115 from koic/tweak_list_of_instrumentation_in_the_readme
[Docs] Fix broken list rendering of Instrumentation in the README
2025-08-25 15:25:29 +09:00
Koichi ITO
e3e67aac08 [Docs] Fix broken list rendering of Instrumentation in the README
This PR fixes the broken rendering of the following list:
https://github.com/modelcontextprotocol/ruby-sdk/tree/v0.2.0?tab=readme-ov-file#instrumentation
2025-08-25 10:45:22 +09:00
Koichi ITO
b4da129aa0 Document title as Draft and restore annotations.title
Follow-up to #109.

The introduction of `title` in #109 is still a draft and is not supported in the latest specification, `Version 2025-06-18 (latest)`.

In this PR, the README.md will be updated to mention this point and restore the references to the removed `annotations.title`.

This aims to inform users that, as of `Version 2025-06-18 (latest)`, the use of `annotations.title` is considered stable.

Additionally, separate validation for these parameters could be added.

Please refer to the following comment regarding `annotations.title` and `title`:
https://github.com/modelcontextprotocol/modelcontextprotocol/pull/663#issuecomment-2963519737
2025-08-23 00:12:12 +09:00
Topher Bullock
62360338f4
Merge pull request #109 from jdnvn/main
Add title to tools, prompts and resources
2025-08-20 16:19:38 -04:00
jdnvn
8b4085468e add titles to tools, prompts and resources 2025-08-17 22:58:15 -04:00
Koichi ITO
f3ad5ff20b [Docs] Remove redundant parentheses
In Ruby, it is generally not customary to add parentheses to methods without arguments.
This PR removes such redundant parentheses from the documentation.
2025-08-18 01:11:27 +09:00
Koichi ITO
930173a04e
Merge pull request #87 from koic/add_instructions_support_to_mcp_server
Add `instructions` support to `MCP::Server`
2025-08-09 03:22:08 +09:00
Koichi ITO
f6f064ab71 Add instructions support to MCP::Server
The response of the `init` method can include `instructions`.
https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle

`instructions` appear to be supported starting from the 2025-03-26 specification.

- https://modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle (supports `instructions`)
- https://modelcontextprotocol.io/specification/2024-11-05/basic/lifecycle (does not support `instructions`)

If `instructions` is used with an unsupported protocol version, an `ArgumentError` will be raised.

As additional context, the TypeScript SDK also treats `instructions` as optional.
https://github.com/modelcontextprotocol/typescript-sdk/blob/1.16.0/src/types.ts#L356-L361
2025-08-07 12:17:57 +09:00
Koichi ITO
31929784d8
Merge pull request #90 from koic/doc_fix_incorrect_example_for_configuring_protocol_version
[Doc] Fix incorrect example for configuring protocol version
2025-08-03 16:23:12 +09:00
Koichi ITO
7a9a6e496c
Merge pull request #92 from koic/update_links_of_mcp_specification
[Doc] Update links of the MCP specification
2025-08-03 16:03:30 +09:00
Koichi ITO
645386eed5
Merge pull request #93 from andyw8/andyw8/clarify-resource-read-handler-example-in-readme
Clarify resource read handler in README
2025-07-31 11:42:50 +09:00
Koichi ITO
eaa9d58a15 [Doc] Update links of the MCP specification
Follow-up to 0695a497.

This PR updates URLs that were changed due to the redesign of the MCP website:
https://modelcontextprotocol.io
2025-07-28 02:28:05 +09:00
Andy Waite
ffb04e13ef Clarify resource read handler in README 2025-07-27 11:31:22 -04:00
dak2
f6eb5ed785 Fix a typo in READEME.md 2025-07-27 10:34:14 +09:00
Koichi ITO
d2ca47be19 [Doc] Fix incorrect example for configuring protocol version
`MCP::Server` does not have a `protocol_version=` method.

```console
$ bin/console
irb(main):001> MCP::Server.protocol_version = "2024-11-05"
(irb):1:in '<main>': undefined method 'protocol_version=' for class MCP::Server (NoMethodError)
        from bin/console:15:in '<main>'
```

This PR fixes an incorrect example that causes the above error.
2025-07-26 23:47:56 +09:00
Andy Waite
f2f7a3fc12 Fix namespacing in README examples 2025-07-25 16:59:54 -04:00
Koichi ITO
2b36bf6b2d Set default protocol version to the latest specification
Currently, MCP has three versions: 2024-11-05, 2025-03-26, and 2025-06-18.

- https://modelcontextprotocol.io/specification/2024-11-05/basic/transports (stdio and HTTP with SSE)
- https://modelcontextprotocol.io/specification/2025-03-26/basic/transports (stdio and Streamable HTTP)
- https://modelcontextprotocol.io/specification/2025-06-18/basic/transports (stdio and Streamable HTTP)

The newer specification supports stdio and Streamable HTTP as transport mechanisms.
Only the oldest version, 2024-11-05, supports stdin and HTTP with SSE,
but that version is now considered legacy.

Given the current behavior of the Ruby SDK, it likely makes more sense to set
the default protocol version to the latest one, 2025-06-18, rather than the oldest, 2024-11-05.

Ideally, the implementation should adjust its behavior based on the version,
but this PR is limited to updating the default protocol version only.
2025-07-20 16:36:18 +09:00
Koichi ITO
f13522d416 Validate protocol_version value
## Motivation and Context

Currently, MCP supports the following three protocol versions:
"2025-06-18", "2025-03-26", and "2024-11-05".
https://modelcontextprotocol.io/introduction

As shown in the changes to `test/mcp/configuration_test.rb`,
the `protocol_version` value is not currently being validated,
which allows unexpected `protocol_version` values to be accepted.

This PR ensures that only supported protocol versions are accepted.

## How Has This Been Tested?

Existing tests have been updated and new tests have been added.

## Breaking Changes

None. If it becomes an issue, it means a value that was not originally intended has been used.

## Additional context

While one possible approach might be to fall back to a default protocol version
when an invalid `protocol_version` value is provided,
this PR opts to reject invalid `protocol_version` values explicitly.
The reasoning is that encouraging users to provide intentional,
valid input is preferable to silently falling back to a default,
which could lead to unexpected behavior.
2025-07-16 12:38:49 +09:00
Ates Goral
bdd118a568 Update release process
fixup: Remove "the"
2025-07-15 15:44:58 -04:00
Ates Goral
1ed313951a Add define_custom_method to define custom methods 2025-07-14 20:12:29 -04:00