Commit graph

235 commits

Author SHA1 Message Date
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
Koichi ITO
97640ed626
Merge pull request #28 from jcat4/add-basic-http-client-support
Add basic http client support
2025-09-09 18:51:07 +09:00
Joey Cardosi
8b764428b1
Add basic HTTP client support with pluggable transports 2025-09-08 15:52:37 -05:00
Koichi ITO
eab21be94f
Merge pull request #130 from koic/reduce_any_p
Combine redundant `any?` calls
2025-09-08 07:37:50 +09:00
Koichi ITO
b9f1c58899 Combine redundant any? calls
Calling `parameters.any?` twice is redundant.
2025-09-07 10:04:18 +09: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
eb0d9c0e6d
Merge pull request #121 from koic/document_mcp_resource_template
[Docs] Document `MCP::ResourceTemplate`
2025-08-31 17:49:42 +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
e51c692e93
Merge pull request #120 from koic/add_tools_call_example_in_readme
[Docs] Add a `tools/call` example in README
2025-08-29 14:47:11 +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
9486c63545
Merge pull request #117 from koic/extract_tool_annotations_tests
Extract `MCP::Tool::Annotations` unit tests
2025-08-27 14:57:48 +09:00
Koichi ITO
092aebf1a4 Extract MCP::Tool::Annotations unit tests
The tests related to `MCP::Tool::Annotations` will be extracted from the `MCP::ToolTest` test class
into a dedicated `MCP::Tool::AnnotationsTest` unit test class as a testing pair.

This improves test clarity, file level test independence, and file level execution speed.
It also ensures consistent placement as a testing pair under `MCP::Tool::*`:

```console
$ ls lib/mcp/tool/
annotations.rb  input_schema.rb  response.rb
$ ls test/mcp/tool/
annotations_test.rb  input_schema_test.rb  response_test.rb
```
2025-08-27 13:33:21 +09:00
Koichi ITO
aec8fb8b00
Merge pull request #116 from koic/tweak_assert_equal_argument_order_in_tests
Tweak `assert_equal` argument order in tests
2025-08-27 11:07:00 +09:00
Koichi ITO
ae5a41588e Tweak assert_equal argument order in tests
The argument order for `assert_equal` is expected, actual:
https://github.com/minitest/minitest/blob/v5.25.5/lib/minitest/assertions.rb#L214

This PR corrects the arguments that were reversed to the expected order.
It also enables `Minitest/LiteralAsActualArgument`, which can detect and
autocorrect some of these cases:
https://docs.rubocop.org/rubocop-minitest/0.38/cops_minitest.html#minitestliteralasactualargument
2025-08-27 01:43:55 +09:00
Koichi ITO
022b3ff640
Merge pull request #84 from planio-gmbh/fix/implement-notifications-initialized
implements the notifications/initialized method
2025-08-26 05:54:07 +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
Jens Kraemer
be5e7db2a6 implements the notifications/initialized method
- According to
  https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle,
  "After successful initialization, the client MUST send an initialized
  notification to indicate it is ready to begin normal operations".
2025-08-25 13:44:21 +08: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
541bbe0859
Merge pull request #113 from koic/document_title_as_draft_and_restore_annotations_title
Document `title` as Draft and restore `annotations.title`
2025-08-24 01:23:19 +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
06bf90dd98
Merge pull request #97 from honzasterba/rubymine_test_runner_support
[test] minites-reporters do not work with RubyMine
2025-08-20 16:25:13 -04: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
Koichi ITO
002df2c774
Merge pull request #107 from pusewicz/response-keyword-boolean
Response error keyword argument
2025-08-20 18:26:17 +09:00
Jan Sterba
1895168115 [test] remove minitest-reporters
gem not compatible with rubymine test runner
2025-08-20 11:17:20 +02:00
Koichi ITO
f63f360a7b
Merge pull request #108 from koic/remove_redundant_parentheses
[Docs] Remove redundant parentheses
2025-08-19 00:25:56 +09:00
Piotr Usewicz
6689db2ca0
Nicer error API
Both the combination of positional argument and naming does not feel
like Ruby.

This change makes `is_error` argument a keyword argument called `error`.

Thanks to this, the usage is more self-explanatory:

```ruby
response = Response.new([], error: true)
```
2025-08-18 16:50:20 +02: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
d1c6a46e1a
Merge pull request #105 from siddhantbajaj/handle-notification-initialized-method
Return HTTP status code 202 for notification initialized method
2025-08-13 00:38:36 +09:00
Siddhant Bajaj
4a65f62158 Return HTTP status code 202 for notification initialized method 2025-08-11 10:40:17 -04:00
Koichi ITO
33258623a7
Merge pull request #106 from koic/remove_useless_code_in_test_helper
Remove useless code in test/test_helper.rb
2025-08-11 03:37:54 +09:00
Koichi ITO
216266756a Remove useless code in test/test_helper.rb
This PR removes useless code in test/test_helper.rb.
2025-08-10 01:11:21 +08: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
22a7db73fd
Merge pull request #104 from koic/fix_an_incorrect_url
[Doc] Fix an incorrect URL
2025-08-08 01:31:08 +09:00
Koichi ITO
2e4e80f727 [Doc] Fix an incorrect URL
This PR fixes the following incorrect URL:
https://spec.MCP.io/specification/2025-03-26/basic/utilities/ping/#behavior-requirements

The specification version used in the official links follows "2025-06-18,"
which is the version consistently used throughout the README.md.
2025-08-07 12:45:50 +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
122bbd0c6c
Merge pull request #102 from koic/remove_redundant_required_features
Remove redundant `require` statements
2025-08-04 06:22:56 +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
c5dde9ce2b Remove redundant require statements
This PR removes redundant `require` statements.
2025-08-02 00:57:31 +09:00
Koichi ITO
2c3f218d8f
Merge pull request #100 from pusewicz/default-input-schema
Empty inputSchema requires the type key
2025-08-01 01:50:17 +09:00
Piotr Usewicz
2508defc79
inputSchema interface requires type key
When defining a tool without any arguments taken, it should be allowed
to not have to define the `input_schema` at all, and the default value
for such a scenario should be `{ type: "object" }` as per the schema.

16d91abb68/schema/2025-06-18/schema.ts (L896-L900)
2025-07-31 08:36:18 +02: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
4ba1e2b7f4
Merge pull request #95 from andyw8/andyw8/fix-resource-example
Fix stdio server resource example
2025-07-30 12:45:19 +09:00
Koichi ITO
d1ca0cbcfe
Merge pull request #91 from dak2/fix/json-rpc-of-notification
Fix JSON-RPC notification format in Streamable HTTP transport
2025-07-29 02:05:16 +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