@@ -39,70 +39,18 @@ type Annotations struct {
3939 Priority float64 `json:"priority,omitempty"`
4040}
4141
42- type CallToolParams struct {
43- // This property is reserved by the protocol to allow clients and servers to
44- // attach additional metadata to their responses.
45- Meta `json:"_meta,omitempty"`
46- Arguments any `json:"arguments,omitempty"`
47- Name string `json:"name"`
48- }
49-
50- func (x * CallToolParams ) GetProgressToken () any { return getProgressToken (x ) }
51- func (x * CallToolParams ) SetProgressToken (t any ) { setProgressToken (x , t ) }
42+ type CallToolParams = CallToolParamsFor [any ]
5243
5344type CallToolParamsFor [In any ] struct {
5445 // This property is reserved by the protocol to allow clients and servers to
5546 // attach additional metadata to their responses.
5647 Meta `json:"_meta,omitempty"`
57- Arguments In `json:"arguments,omitempty"`
5848 Name string `json:"name"`
49+ Arguments In `json:"arguments,omitempty"`
5950}
6051
6152// The server's response to a tool call.
62- type CallToolResult struct {
63- // This property is reserved by the protocol to allow clients and servers to
64- // attach additional metadata to their responses.
65- Meta `json:"_meta,omitempty"`
66- // A list of content objects that represent the unstructured result of the tool
67- // call.
68- Content []Content `json:"content"`
69- // Whether the tool call ended in an error.
70- //
71- // If not set, this is assumed to be false (the call was successful).
72- //
73- // Any errors that originate from the tool should be reported inside the result
74- // object, with isError set to true, not as an MCP protocol-level error
75- // response. Otherwise, the LLM would not be able to see that an error occurred
76- // and self-correct.
77- //
78- // However, any errors in finding the tool, an error indicating that the
79- // server does not support tool calls, or any other exceptional conditions,
80- // should be reported as an MCP error response.
81- IsError bool `json:"isError,omitempty"`
82- // An optional JSON object that represents the structured result of the tool
83- // call.
84- // TODO(jba,rfindley): should this be any?
85- StructuredContent map [string ]any `json:"structuredContent,omitempty"`
86- }
87-
88- // UnmarshalJSON handles the unmarshalling of content into the Content
89- // interface.
90- func (x * CallToolResult ) UnmarshalJSON (data []byte ) error {
91- type res CallToolResult // avoid recursion
92- var wire struct {
93- res
94- Content []* wireContent `json:"content"`
95- }
96- if err := json .Unmarshal (data , & wire ); err != nil {
97- return err
98- }
99- var err error
100- if wire .res .Content , err = contentsFromWire (wire .Content , nil ); err != nil {
101- return err
102- }
103- * x = CallToolResult (wire .res )
104- return nil
105- }
53+ type CallToolResult = CallToolResultFor [any ]
10654
10755type CallToolResultFor [Out any ] struct {
10856 // This property is reserved by the protocol to allow clients and servers to
@@ -111,6 +59,9 @@ type CallToolResultFor[Out any] struct {
11159 // A list of content objects that represent the unstructured result of the tool
11260 // call.
11361 Content []Content `json:"content"`
62+ // An optional JSON object that represents the structured result of the tool
63+ // call.
64+ StructuredContent Out `json:"structuredContent,omitempty"`
11465 // Whether the tool call ended in an error.
11566 //
11667 // If not set, this is assumed to be false (the call was successful).
@@ -124,9 +75,6 @@ type CallToolResultFor[Out any] struct {
12475 // server does not support tool calls, or any other exceptional conditions,
12576 // should be reported as an MCP error response.
12677 IsError bool `json:"isError,omitempty"`
127- // An optional JSON object that represents the structured result of the tool
128- // call.
129- StructuredContent Out `json:"structuredContent,omitempty"`
13078}
13179
13280// UnmarshalJSON handles the unmarshalling of content into the Content
@@ -148,6 +96,9 @@ func (x *CallToolResultFor[Out]) UnmarshalJSON(data []byte) error {
14896 return nil
14997}
15098
99+ func (x * CallToolParamsFor [Out ]) GetProgressToken () any { return getProgressToken (x ) }
100+ func (x * CallToolParamsFor [Out ]) SetProgressToken (t any ) { setProgressToken (x , t ) }
101+
151102type CancelledParams struct {
152103 // This property is reserved by the protocol to allow clients and servers to
153104 // attach additional metadata to their responses.
0 commit comments