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
pass.ReportRangef(call, "%s format %s has arg %s of wrong type %s%s", name, operation.Text, analysisinternal.Format(pass.Fset, arg), typeString, details)
Copy file name to clipboardExpand all lines: internal/mcp/design/design.md
+12-5Lines changed: 12 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ Types needed for the protocol are generated from the [JSON schema of the MCP spe
243
243
244
244
These types will be included in the `mcp` package, but will be unexported unless they are needed for the user-facing API. Notably, JSON-RPC request types are elided, since they are handled by the `jsonrpc2` package and should not be observed by the user.
245
245
246
-
For user-provided data, we use `json.RawMessage`, so that marshalling/unmarshalling can be delegated to the business logic of the client or server.
246
+
For user-provided data, we use `json.RawMessage` or `map[string]any`, depending on the use case.
247
247
248
248
For union types, which can't be represented in Go (specifically `Content` and `ResourceContents`), we prefer distinguished unions: struct types with fields corresponding to the union of all properties for union elements.
249
249
@@ -255,9 +255,9 @@ type ReadResourceParams struct {
255
255
}
256
256
257
257
type CallToolResult struct {
258
-
Meta map[string]json.RawMessage`json:"_meta,omitempty"`
259
-
Content []Content `json:"content"`
260
-
IsError bool`json:"isError,omitempty"`
258
+
Meta Meta `json:"_meta,omitempty"`
259
+
Content []Content `json:"content"`
260
+
IsError bool`json:"isError,omitempty"`
261
261
}
262
262
263
263
// Content is the wire format for content.
@@ -276,6 +276,7 @@ type Content struct {
276
276
funcNewTextContent(text string) *Content
277
277
// etc.
278
278
```
279
+
The `Meta` type includes a `map[string]any` for arbitrary data, and a `ProgressToken` field.
279
280
280
281
**Differences from mcp-go**: these types are largely similar, but our type generator flattens types rather than using struct embedding.
281
282
@@ -480,15 +481,21 @@ The server observes a client cancellation as a cancelled context.
480
481
481
482
### Progress handling
482
483
483
-
A caller can request progress notifications by setting the `ProgressToken` field on any request.
484
+
A caller can request progress notifications by setting the `Meta.ProgressToken` field on any request.
484
485
485
486
```go
486
487
type XXXParams struct { // where XXX is each type of call
488
+
Meta Meta
487
489
...
490
+
}
491
+
492
+
type Meta struct {
493
+
Data map[string]any
488
494
ProgressToken any // string or int
489
495
}
490
496
```
491
497
498
+
492
499
Handlers can notify their peer about progress by calling the `NotifyProgress` method. The notification is only sent if the peer requested it by providing a progress token.
0 commit comments