Skip to content

Commit 72e39fa

Browse files
committed
all: minor cleanup
1 parent fd0dc9d commit 72e39fa

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

docs/client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func Example_elicitation() {
145145
}
146146
defer ss.Close()
147147

148-
c := mcp.NewClient(testImpl, &mcp.ClientOptions{
148+
c := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v0.0.1"}, &mcp.ClientOptions{
149149
ElicitationHandler: func(context.Context, *mcp.ElicitRequest) (*mcp.ElicitResult, error) {
150150
return &mcp.ElicitResult{Action: "accept", Content: map[string]any{"test": "value"}}, nil
151151
},

mcp/client_example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func Example_elicitation() {
112112
}
113113
defer ss.Close()
114114

115-
c := mcp.NewClient(testImpl, &mcp.ClientOptions{
115+
c := mcp.NewClient(&mcp.Implementation{Name: "client", Version: "v0.0.1"}, &mcp.ClientOptions{
116116
ElicitationHandler: func(context.Context, *mcp.ElicitRequest) (*mcp.ElicitResult, error) {
117117
return &mcp.ElicitResult{Action: "accept", Content: map[string]any{"test": "value"}}, nil
118118
},

mcp/server.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func setSchema[T any](sfield *any, rfield **jsonschema.Resolved) (zero any, err
380380
// If the tool's input schema is nil, it is set to the schema inferred from the
381381
// In type parameter. Types are inferred from Go types, and property
382382
// descriptions are read from the 'jsonschema' struct tag. Internally, the SDK
383-
// uses the github.com/google/jsonschema-go package for ineference and
383+
// uses the github.com/google/jsonschema-go package for inference and
384384
// validation. The In type argument must be a map or a struct, so that its
385385
// inferred JSON Schema has type "object", as required by the spec. As a
386386
// special case, if the In type is 'any', the tool's input schema is set to an
@@ -498,6 +498,9 @@ func (s *Server) changeAndNotify(notification string, params Params, change func
498498
}
499499

500500
// Sessions returns an iterator that yields the current set of server sessions.
501+
//
502+
// There is not guarantee that the iterator observes sessions that are added or
503+
// removed during iteration.
501504
func (s *Server) Sessions() iter.Seq[*ServerSession] {
502505
s.mu.Lock()
503506
clients := slices.Clone(s.sessions)

mcp/transport.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,12 @@ func (t *InMemoryTransport) Connect(context.Context) (Connection, error) {
104104
return newIOConn(t.rwc), nil
105105
}
106106

107-
// NewInMemoryTransports returns two [InMemoryTransports] that connect to each
108-
// other.
107+
// NewInMemoryTransports returns two [InMemoryTransport] objects that connect
108+
// to each other.
109+
//
110+
// The resulting transports are symmetrical: use either to connect a to a
111+
// server, and then the other to connect to a client. Servers must be connected
112+
// before clients, as the client initializes the MCP session during connection.
109113
func NewInMemoryTransports() (*InMemoryTransport, *InMemoryTransport) {
110114
c1, c2 := net.Pipe()
111115
return &InMemoryTransport{c1}, &InMemoryTransport{c2}

0 commit comments

Comments
 (0)