all: fix some function names and typos in comment
Change-Id: I8066b22cb87e09fb160de3b8ff2d8fdde6ec3dcf Reviewed-on: https://go-review.googlesource.com/c/tools/+/675815 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
8962b38ba5
commit
b7d1ec0604
8 changed files with 11 additions and 11 deletions
|
|
@ -88,7 +88,7 @@ func main() {
|
|||
// Create a server with a single tool.
|
||||
server := mcp.NewServer("greeter", "v1.0.0", nil)
|
||||
server.AddTools(mcp.NewTool("greet", "say hi", SayHi))
|
||||
// Run the server over stdin/stdout, until the client diconnects
|
||||
// Run the server over stdin/stdout, until the client disconnects
|
||||
_ = server.Run(context.Background(), mcp.NewStdIOTransport())
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ func main() {
|
|||
// Create a server with a single tool.
|
||||
server := mcp.NewServer("greeter", "v1.0.0", nil)
|
||||
server.AddTools(mcp.NewTool("greet", "say hi", SayHi))
|
||||
// Run the server over stdin/stdout, until the client diconnects
|
||||
// Run the server over stdin/stdout, until the client disconnects
|
||||
_ = server.Run(context.Background(), mcp.NewStdIOTransport())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// Helpers below are copied from gopls' moremaps package.
|
||||
|
||||
// sorted returns an iterator over the entries of m in key order.
|
||||
// Sorted returns an iterator over the entries of m in key order.
|
||||
func Sorted[M ~map[K]V, K cmp.Ordered, V any](m M) iter.Seq2[K, V] {
|
||||
// TODO(adonovan): use maps.Sorted if proposal #68598 is accepted.
|
||||
return func(yield func(K, V) bool) {
|
||||
|
|
@ -26,7 +26,7 @@ func Sorted[M ~map[K]V, K cmp.Ordered, V any](m M) iter.Seq2[K, V] {
|
|||
}
|
||||
}
|
||||
|
||||
// keySlice returns the keys of the map M, like slices.Collect(maps.Keys(m)).
|
||||
// KeySlice returns the keys of the map M, like slices.Collect(maps.Keys(m)).
|
||||
func KeySlice[M ~map[K]V, K comparable, V any](m M) []K {
|
||||
r := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ func TestResolveURIs(t *testing.T) {
|
|||
|
||||
func TestRefCycle(t *testing.T) {
|
||||
// Verify that cycles of refs are OK.
|
||||
// The test suite doesn't check this, suprisingly.
|
||||
// The test suite doesn't check this, surprisingly.
|
||||
schemas := map[string]*Schema{
|
||||
"root": {Ref: "a"},
|
||||
"a": {Ref: "b"},
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ func NewTextResourceContents(uri, mimeType, text string) *ResourceContents {
|
|||
}
|
||||
}
|
||||
|
||||
// NewTextResourceContents returns a [ResourceContents] containing a byte slice.
|
||||
// NewBlobResourceContents returns a [ResourceContents] containing a byte slice.
|
||||
func NewBlobResourceContents(uri, mimeType string, blob []byte) *ResourceContents {
|
||||
// The only way to distinguish text from blob is a non-nil Blob field.
|
||||
if blob == nil {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ type Server struct {
|
|||
type ServerOptions struct {
|
||||
// Optional instructions for connected clients.
|
||||
Instructions string
|
||||
// If non-nil, called when "notifications/intialized" is received.
|
||||
// If non-nil, called when "notifications/initialized" is received.
|
||||
InitializedHandler func(context.Context, *ServerSession, *InitializedParams)
|
||||
// PageSize is the maximum number of items to return in a single page for
|
||||
// list methods (e.g. ListTools).
|
||||
|
|
@ -122,7 +122,7 @@ func (s *Server) RemoveTools(names ...string) {
|
|||
func() bool { return s.tools.remove(names...) })
|
||||
}
|
||||
|
||||
// AddResource adds the given resource to the server and associates it with
|
||||
// AddResources adds the given resource to the server and associates it with
|
||||
// a [ResourceHandler], which will be called when the client calls [ClientSession.ReadResource].
|
||||
// If a resource with the same URI already exists, this one replaces it.
|
||||
// AddResource panics if a resource URI is invalid or not absolute (has an empty scheme).
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ const (
|
|||
// See https://modelcontextprotocol.io/specification/2025-03-26/server/resources#error-handling
|
||||
// However, the code they chose is in the wrong space
|
||||
// (see https://github.com/modelcontextprotocol/modelcontextprotocol/issues/509).
|
||||
// so we pick a different one, arbirarily for now (until they fix it).
|
||||
// so we pick a different one, arbitrarily for now (until they fix it).
|
||||
// The immediate problem is that jsonprc2 defines -32002 as "server closing".
|
||||
CodeResourceNotFound = -31002
|
||||
// The error code if the method exists and was called properly, but the peer does not support it.
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ type SSEServerTransport struct {
|
|||
incoming chan jsonrpc2.Message // queue of incoming messages; never closed
|
||||
|
||||
// We must guard both pushes to the incoming queue and writes to the response
|
||||
// writer, because incoming POST requests are abitrarily concurrent and we
|
||||
// writer, because incoming POST requests are arbitrarily concurrent and we
|
||||
// need to ensure we don't write push to the queue, or write to the
|
||||
// ResponseWriter, after the session GET request exits.
|
||||
mu sync.Mutex
|
||||
|
|
@ -431,7 +431,7 @@ func (c *SSEClientTransport) Connect(ctx context.Context) (Stream, error) {
|
|||
|
||||
// An sseClientStream is a logical jsonrpc2 stream that implements the client
|
||||
// half of the SSE protocol:
|
||||
// - Writes are POSTS to the sesion endpoint.
|
||||
// - Writes are POSTS to the session endpoint.
|
||||
// - Reads are SSE 'message' events, and pushes them onto a buffered channel.
|
||||
// - Close terminates the GET request.
|
||||
type sseClientStream struct {
|
||||
|
|
|
|||
Loading…
Reference in a new issue