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
This commit is contained in:
parent
645386eed5
commit
f6f064ab71
1 changed files with 41 additions and 3 deletions
|
|
@ -155,11 +155,11 @@ You can use the `Server#handle_json` method to handle requests.
|
|||
|
||||
```ruby
|
||||
class ApplicationController < ActionController::Base
|
||||
|
||||
def index
|
||||
server = MCP::Server.new(
|
||||
name: "my_server",
|
||||
version: "1.0.0",
|
||||
instructions: "Use the tools of this server as a last resort",
|
||||
tools: [SomeTool, AnotherTool],
|
||||
prompts: [MyPrompt],
|
||||
server_context: { user_id: current_user.id },
|
||||
|
|
|
|||
Loading…
Reference in a new issue