Commit graph

272 commits

Author SHA1 Message Date
Koichi ITO
435b8c8b22 Move dependabot.yml into .github
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/138.

The `dependabot.yml` file must be placed under the `.github` directory,
but it was mistakenly placed outside of it.
2025-10-04 00:14:49 +09:00
Koichi ITO
c5f2f98077
Merge pull request #150 from koic/set_default_content_to_an_empty_array_instead_of_nil
Set default `content` to an empty array instead of `nil`
2025-10-03 10:22:46 +09:00
Koichi ITO
0034952df9 Set default content to an empty array instead of nil
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/147.

According to the specification schema, `content` is not optional and therefore cannot be omitted:

```typescript
interface CallToolResult {
  _meta?: { [key: string]: unknown };
  content: ContentBlock[];
  isError?: boolean;
  structuredContent?: { [key: string]: unknown };
  [key: string]: unknown;
}
```

https://modelcontextprotocol.io/specification/2025-06-18/schema#calltoolresult

Instead of `nil`, an empty array is set as the default value.

There may be a better value for `content`, but at the very least it should not be missing.
2025-10-02 23:52:19 +09:00
Tyler Untisz
73cec83b99
Add support for _meta field on tool schema (#124)
* Add support for _meta field on tool schema

* use `meta` naming for `_meta` field on tool schema

* apply suggestions to fix `_meta` tests

Co-authored-by: Ateş Göral <ates@magnetiq.com>

* Update lib/mcp/tool.rb

Co-authored-by: Ateş Göral <ates@magnetiq.com>

* Update lib/mcp/tool.rb

Co-authored-by: Ateş Göral <ates@magnetiq.com>

---------

Co-authored-by: Topher Bullock <topherbullock@users.noreply.github.com>
Co-authored-by: Ateş Göral <ates@magnetiq.com>
2025-10-01 17:21:27 -04:00
Topher Bullock
c0f7605d25
Merge pull request #149 from juharris/client-call_tool_raw
[client] Change call_tool method to return the full tool response to help get structuredContent
2025-10-01 15:37:49 -04:00
Justin Harris
ae60e2d904
[client] Add call_tool_raw method to get the full tool response to help get structuredContent 2025-10-01 15:18:02 -04:00
Koichi ITO
010ae74edc
Merge pull request #145 from koic/add_validation_to_mcp_configuration_setters
Add validation to `MCP::Configuration` setters
2025-10-01 10:50:38 +09:00
Koichi ITO
f21629ca74
Merge pull request #148 from koic/remove_redundant_sort_in_spec
Remove redundant sort in spec
2025-09-30 00:17:12 +09:00
Koichi ITO
777785b333 Remove redundant sort in spec 2025-09-29 01:24:38 +09: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
99b57a3cc2
Merge pull request #114 from dak2/handle-202
Fix to return a response code 202 if the server accepts JSON-RPC notifications and responses
2025-09-27 14:00:17 +09:00
Koichi ITO
8f682c4ff6
Merge pull request #146 from koic/fix_some_typos
Fix some typos
2025-09-26 10:12:46 +09:00
dak2
cd7a54a5c9 Fix to return a response code 202 if the server accepts JSON-RPC notifications and responses
If the server accepts JSON-RPC notifications and responses, it must return an HTTP status code of 202 without a body.

refs
- https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#sending-messages-to-the-server
- https://www.jsonrpc.org/specification

Follow up: https://github.com/modelcontextprotocol/ruby-sdk/issues/111
2025-09-26 00:18:01 +09: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
Koichi ITO
cb5e87581b Add validation to MCP::Configuration setters
I noticed through the existing tests that `MCP::Configuration#protocol_version=`
allows setting an arbitrary protocol version.

Since the official MCP Ruby SDK is an implementation of the MCP specification,
it should not support arbitrary protocol versions. This change adds validation
to the setter, consistent with `Configuration#initialize`.

The same validation has also been added to `MCP::Configuration#validate_tool_call_arguments=`.
2025-09-24 19:19:02 +09:00
Ateş Göral
aba616342f
Add AGENTS.md with comprehensive development guidance (#134)
* Add CLAUDE.md with development guidance and architecture overview

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Rename CLAUDE.md to AGENTS.md and restructure to follow agents.md standard

- Adopt the new agents.md format for AI coding assistant guidance
- Reorganize content into standard sections: project overview, dev setup, build commands, testing, code style, and architecture
- Maintain all essential technical information while improving accessibility
- Support the growing ecosystem of AI tools that recognize agents.md

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Consolidate Cursor-specific rules into AGENTS.md and remove tool-specific files

- Add release process section to AGENTS.md with changelog guidelines
- Include Keep a Changelog format requirements and entry formatting rules
- Remove .cursor/rules/release-changelogs.mdc to favor universal AGENTS.md format
- Ensure all AI coding assistants have access to release documentation guidelines

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add blank lines after headings

Co-authored-by: Koichi ITO <koic.ito@gmail.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Koichi ITO <koic.ito@gmail.com>
2025-09-22 23:25:29 -04:00
Koichi ITO
e168292876
Merge pull request #139 from koic/remove_useless_block_argument
Remove unused block parameters
2025-09-21 13:09:20 +09:00
Koichi ITO
0c8937de34 Remove unused block parameters
There are some unused block variables. This change removes block parameters
that consist solely of unused block parameters.
Where `Hash#values` suffices instead of ignoring unused variables,
replace such code with `Hash#values`.
2025-09-20 14:45:08 +09:00
Koichi ITO
a17b23e1a4
Merge pull request #138 from koic/enable_dependabot
Enable Dependabot
2025-09-18 09:37:12 +09:00
Koichi ITO
30d2b0b22b Enable Dependabot
Configure Dependabot to automatically detect updates to the actions used in
GitHub Actions (e.g., `actions/checkout`) and create pull requests for them.

Based on experience, checking for updates on a weekly interval should work well.
2025-09-17 00:26:25 +09:00
Koichi ITO
d67609d43d
Merge pull request #137 from koic/remove_useless_magic_comment
Remove useless magic comment
2025-09-16 02:35:22 +09:00
Koichi ITO
b626425521 Remove useless magic comment
This PR removes useless magic comment.
2025-09-15 12:33:09 +09:00
Ateş Göral
70384c8362
Merge pull request #135 from modelcontextprotocol/ag/v0.3.0 v0.3.0
Release v0.3.0
2025-09-14 10:20:39 -04:00
Ates Goral
deebefd26f Release v0.3.0
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 01:09:18 -04:00
Koichi ITO
bdd69956d5
Merge pull request #133 from codenamev/main
Add Tool output_schema support with comprehensive validation
2025-09-14 09:08:14 +09: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
3f2a4b3b21
Merge pull request #125 from koic/reduce_stdout_headge_in_example
Reduce stdout hedge in examples
2025-09-11 10:31:01 +09:00
Koichi ITO
dd5b318b11
Merge pull request #126 from koic/fix_errors_when_title_is_not_specified
Fix errors when `title` is not specified
2025-09-11 10:30:15 +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
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
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
47d29e8014 Fix errors when title is not specified
Since the optional `title` becomes `title: null` when not provided, the following error occurs.
This occurs with Claude Code 1.0.100.

```console
[DEBUG] MCP server "example": Connection failed after 1591ms: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "null",
    "path": [
      "serverInfo",
      "title"
    ],
    "message": "Expected string, received null"
  }
]
```

By adding `compact`, the `title` key will be removed if the optional `title` keyword argument is not specified.
2025-09-03 12:31:33 +09:00
Koichi ITO
03e35c73c3 Reduce stdout hedge in examples
This PR reduces redundant stdout in examples by replacing
multiple `puts` with a heredoc and by removing unnecessary `puts`.
2025-09-02 11:30:31 +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