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
Handlers and client/server methods take a single request argument
combining the session and params. This slightly simplifies the signature
for handlers, since there is no longer an often-ignored session
argument.
But more importantly, it opens the door to adding more information in
requests, such as auth info and HTTP request headers.
For #243.
**Differences from mcp-go**: We provide a full JSON Schema implementation for validating tool input schemas against incoming arguments. The `jsonschema.Schema` type provides exported features for all keywords in the JSON Schema draft2020-12 spec. Tool definers can use it to construct any schema they want. The `jsonschema.For[T]` function can infer a schema from a Go struct. These combined features eliminate the need for variadic arguments to construct tool schemas.
@@ -775,10 +771,10 @@ If a server author wants to support resource subscriptions, they must provide ha
775
771
```go
776
772
type ServerOptions struct {
777
773
...
778
-
// Function called when a client session subscribes to a resource.
779
-
SubscribeHandler func(context.Context, ss *ServerSession, *SubscribeParams) error
780
-
// Function called when a client session unsubscribes from a resource.
781
-
UnsubscribeHandler func(context.Context, ss *ServerSession, *UnsubscribeParams) error
774
+
// Function called when a client session subscribes to a resource.
Clients call the spec method `Complete` to request completions. If a server installs a `CompletionHandler`, it will be called when the client sends a completion request.
812
808
813
809
```go
814
-
// A CompletionHandler handles a call to completion/complete.
815
-
type CompletionHandler func(context.Context, *ServerSession, *CompleteParams) (*CompleteResult, error)
816
-
817
810
type ServerOptions struct {
818
811
...
819
812
// If non-nil, called when a client sends a completion request.
0 commit comments