You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tools can return error information alongside text content using the `error` parameter.
628
+
629
+
The error will be included in the JSON-RPC response as the `isError` field.
630
+
631
+
```ruby
632
+
classWeatherTool < MCP::Tool
633
+
description "Get current weather and return structured data"
634
+
635
+
defself.call(server_context:)
636
+
# Do something here
637
+
content = {}
638
+
639
+
MCP::Tool::Response.new(
640
+
[{
641
+
type:"text",
642
+
text: content.to_json
643
+
}],
644
+
structured_content: content,
645
+
error:true
646
+
)
647
+
end
648
+
end
649
+
```
650
+
625
651
### Prompts
626
652
627
653
MCP spec includes [Prompts](https://modelcontextprotocol.io/specification/2025-06-18/server/prompts), which enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs.
0 commit comments