Skip to content

Commit 619bc41

Browse files
authored
internal/jsonrpc2,mcp: fix typos (#183)
- add links to doc strings - use correct symbol and package names
1 parent 261a63c commit 619bc41

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

internal/jsonrpc2/conn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (c *Connection) updateInFlight(f func(*inFlightState)) {
125125
// that and avoided making any updates that would cause the state to be
126126
// non-idle.)
127127
if !s.idle() {
128-
panic("jsonrpc2_v2: updateInFlight transitioned to non-idle when already done")
128+
panic("jsonrpc2: updateInFlight transitioned to non-idle when already done")
129129
}
130130
return
131131
default:
@@ -718,7 +718,7 @@ func (c *Connection) processResult(from any, req *incomingRequest, result any, e
718718
req.cancel()
719719
c.updateInFlight(func(s *inFlightState) {
720720
if s.incoming == 0 {
721-
panic("jsonrpc2_v2: processResult called when incoming count is already zero")
721+
panic("jsonrpc2: processResult called when incoming count is already zero")
722722
}
723723
s.incoming--
724724
})

mcp/server.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const DefaultPageSize = 1000
2929
// A Server is an instance of an MCP server.
3030
//
3131
// Servers expose server-side MCP features, which can serve one or more MCP
32-
// sessions by using [Server.Start] or [Server.Run].
32+
// sessions by using [Server.Run].
3333
type Server struct {
3434
// fixed at creation
3535
impl *Implementation
@@ -74,8 +74,7 @@ type ServerOptions struct {
7474
// NewServer creates a new MCP server. The resulting server has no features:
7575
// add features using the various Server.AddXXX methods, and the [AddTool] function.
7676
//
77-
// The server can be connected to one or more MCP clients using [Server.Start]
78-
// or [Server.Run].
77+
// The server can be connected to one or more MCP clients using [Server.Run].
7978
//
8079
// The first argument must not be nil.
8180
//
@@ -733,7 +732,7 @@ func (ss *ServerSession) handle(ctx context.Context, req *jsonrpc.Request) (any,
733732
}
734733
// For the streamable transport, we need the request ID to correlate
735734
// server->client calls and notifications to the incoming request from which
736-
// they originated. See [idContext] for details.
735+
// they originated. See [idContextKey] for details.
737736
ctx = context.WithValue(ctx, idContextKey{}, req.ID)
738737
return handleReceive(ctx, ss, req)
739738
}

mcp/shared.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type MethodHandler[S Session] func(ctx context.Context, _ S, method string, para
4444
// the compiler would complain.
4545
type methodHandler any // MethodHandler[*ClientSession] | MethodHandler[*ServerSession]
4646

47-
// A Session is either a ClientSession or a ServerSession.
47+
// A Session is either a [ClientSession] or a [ServerSession].
4848
type Session interface {
4949
*ClientSession | *ServerSession
5050
// ID returns the session ID, or the empty string if there is none.
@@ -57,7 +57,7 @@ type Session interface {
5757
getConn() *jsonrpc2.Connection
5858
}
5959

60-
// Middleware is a function from MethodHandlers to MethodHandlers.
60+
// Middleware is a function from [MethodHandler] to [MethodHandler].
6161
type Middleware[S Session] func(MethodHandler[S]) MethodHandler[S]
6262

6363
// addMiddleware wraps the handler in the middleware functions.

mcp/transport.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ type canceller struct {
134134
conn *jsonrpc2.Connection
135135
}
136136

137-
// Preempt implements jsonrpc2.Preempter.
137+
// Preempt implements [jsonrpc2.Preempter].
138138
func (c *canceller) Preempt(ctx context.Context, req *jsonrpc.Request) (result any, err error) {
139139
if req.Method == "notifications/cancelled" {
140140
var params CancelledParams
@@ -203,7 +203,7 @@ type loggingConn struct {
203203

204204
func (c *loggingConn) SessionID() string { return c.delegate.SessionID() }
205205

206-
// loggingReader is a stream middleware that logs incoming messages.
206+
// Read is a stream middleware that logs incoming messages.
207207
func (s *loggingConn) Read(ctx context.Context) (jsonrpc.Message, error) {
208208
msg, err := s.delegate.Read(ctx)
209209
if err != nil {
@@ -218,7 +218,7 @@ func (s *loggingConn) Read(ctx context.Context) (jsonrpc.Message, error) {
218218
return msg, err
219219
}
220220

221-
// loggingWriter is a stream middleware that logs outgoing messages.
221+
// Write is a stream middleware that logs outgoing messages.
222222
func (s *loggingConn) Write(ctx context.Context, msg jsonrpc.Message) error {
223223
err := s.delegate.Write(ctx, msg)
224224
if err != nil {

0 commit comments

Comments
 (0)