internal/jsonrpc2,mcp: fix typos (#183)
- add links to doc strings - use correct symbol and package names
This commit is contained in:
parent
261a63ccc0
commit
619bc41581
4 changed files with 10 additions and 11 deletions
|
|
@ -125,7 +125,7 @@ func (c *Connection) updateInFlight(f func(*inFlightState)) {
|
|||
// that and avoided making any updates that would cause the state to be
|
||||
// non-idle.)
|
||||
if !s.idle() {
|
||||
panic("jsonrpc2_v2: updateInFlight transitioned to non-idle when already done")
|
||||
panic("jsonrpc2: updateInFlight transitioned to non-idle when already done")
|
||||
}
|
||||
return
|
||||
default:
|
||||
|
|
@ -718,7 +718,7 @@ func (c *Connection) processResult(from any, req *incomingRequest, result any, e
|
|||
req.cancel()
|
||||
c.updateInFlight(func(s *inFlightState) {
|
||||
if s.incoming == 0 {
|
||||
panic("jsonrpc2_v2: processResult called when incoming count is already zero")
|
||||
panic("jsonrpc2: processResult called when incoming count is already zero")
|
||||
}
|
||||
s.incoming--
|
||||
})
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const DefaultPageSize = 1000
|
|||
// A Server is an instance of an MCP server.
|
||||
//
|
||||
// Servers expose server-side MCP features, which can serve one or more MCP
|
||||
// sessions by using [Server.Start] or [Server.Run].
|
||||
// sessions by using [Server.Run].
|
||||
type Server struct {
|
||||
// fixed at creation
|
||||
impl *Implementation
|
||||
|
|
@ -74,8 +74,7 @@ type ServerOptions struct {
|
|||
// NewServer creates a new MCP server. The resulting server has no features:
|
||||
// add features using the various Server.AddXXX methods, and the [AddTool] function.
|
||||
//
|
||||
// The server can be connected to one or more MCP clients using [Server.Start]
|
||||
// or [Server.Run].
|
||||
// The server can be connected to one or more MCP clients using [Server.Run].
|
||||
//
|
||||
// The first argument must not be nil.
|
||||
//
|
||||
|
|
@ -733,7 +732,7 @@ func (ss *ServerSession) handle(ctx context.Context, req *jsonrpc.Request) (any,
|
|||
}
|
||||
// For the streamable transport, we need the request ID to correlate
|
||||
// server->client calls and notifications to the incoming request from which
|
||||
// they originated. See [idContext] for details.
|
||||
// they originated. See [idContextKey] for details.
|
||||
ctx = context.WithValue(ctx, idContextKey{}, req.ID)
|
||||
return handleReceive(ctx, ss, req)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ type MethodHandler[S Session] func(ctx context.Context, _ S, method string, para
|
|||
// the compiler would complain.
|
||||
type methodHandler any // MethodHandler[*ClientSession] | MethodHandler[*ServerSession]
|
||||
|
||||
// A Session is either a ClientSession or a ServerSession.
|
||||
// A Session is either a [ClientSession] or a [ServerSession].
|
||||
type Session interface {
|
||||
*ClientSession | *ServerSession
|
||||
// ID returns the session ID, or the empty string if there is none.
|
||||
|
|
@ -57,7 +57,7 @@ type Session interface {
|
|||
getConn() *jsonrpc2.Connection
|
||||
}
|
||||
|
||||
// Middleware is a function from MethodHandlers to MethodHandlers.
|
||||
// Middleware is a function from [MethodHandler] to [MethodHandler].
|
||||
type Middleware[S Session] func(MethodHandler[S]) MethodHandler[S]
|
||||
|
||||
// addMiddleware wraps the handler in the middleware functions.
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ type canceller struct {
|
|||
conn *jsonrpc2.Connection
|
||||
}
|
||||
|
||||
// Preempt implements jsonrpc2.Preempter.
|
||||
// Preempt implements [jsonrpc2.Preempter].
|
||||
func (c *canceller) Preempt(ctx context.Context, req *jsonrpc.Request) (result any, err error) {
|
||||
if req.Method == "notifications/cancelled" {
|
||||
var params CancelledParams
|
||||
|
|
@ -203,7 +203,7 @@ type loggingConn struct {
|
|||
|
||||
func (c *loggingConn) SessionID() string { return c.delegate.SessionID() }
|
||||
|
||||
// loggingReader is a stream middleware that logs incoming messages.
|
||||
// Read is a stream middleware that logs incoming messages.
|
||||
func (s *loggingConn) Read(ctx context.Context) (jsonrpc.Message, error) {
|
||||
msg, err := s.delegate.Read(ctx)
|
||||
if err != nil {
|
||||
|
|
@ -218,7 +218,7 @@ func (s *loggingConn) Read(ctx context.Context) (jsonrpc.Message, error) {
|
|||
return msg, err
|
||||
}
|
||||
|
||||
// loggingWriter is a stream middleware that logs outgoing messages.
|
||||
// Write is a stream middleware that logs outgoing messages.
|
||||
func (s *loggingConn) Write(ctx context.Context, msg jsonrpc.Message) error {
|
||||
err := s.delegate.Write(ctx, msg)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue