many: minor cosmetic changes (#529)
This commit is contained in:
parent
b9c1419ab0
commit
5f05f8a43a
6 changed files with 21 additions and 21 deletions
|
|
@ -668,7 +668,7 @@ func (cs *ClientSession) callProgressNotificationHandler(ctx context.Context, pa
|
|||
// NotifyProgress sends a progress notification from the client to the server
|
||||
// associated with this session.
|
||||
// This can be used if the client is performing a long-running task that was
|
||||
// initiated by the server
|
||||
// initiated by the server.
|
||||
func (cs *ClientSession) NotifyProgress(ctx context.Context, params *ProgressNotificationParams) error {
|
||||
return handleNotify(ctx, notificationProgress, newClientRequest(cs, orZero[Params](params)))
|
||||
}
|
||||
|
|
@ -701,7 +701,7 @@ func (cs *ClientSession) Resources(ctx context.Context, params *ListResourcesPar
|
|||
|
||||
// ResourceTemplates provides an iterator for all resource templates available on the server,
|
||||
// automatically fetching pages and managing cursors.
|
||||
// The `params` argument can set the initial cursor.
|
||||
// The params argument can set the initial cursor.
|
||||
// Iteration stops at the first encountered error, which will be yielded.
|
||||
func (cs *ClientSession) ResourceTemplates(ctx context.Context, params *ListResourceTemplatesParams) iter.Seq2[*ResourceTemplate, error] {
|
||||
if params == nil {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ type ResourceContents struct {
|
|||
Meta Meta `json:"_meta,omitempty"`
|
||||
}
|
||||
|
||||
func (r ResourceContents) MarshalJSON() ([]byte, error) {
|
||||
func (r *ResourceContents) MarshalJSON() ([]byte, error) {
|
||||
// If we could assume Go 1.24, we could use omitzero for Blob and avoid this method.
|
||||
if r.URI == "" {
|
||||
return nil, errors.New("ResourceContents missing URI")
|
||||
|
|
@ -197,7 +197,7 @@ func (r ResourceContents) MarshalJSON() ([]byte, error) {
|
|||
if r.Blob == nil {
|
||||
// Text. Marshal normally.
|
||||
type wireResourceContents ResourceContents // (lacks MarshalJSON method)
|
||||
return json.Marshal((wireResourceContents)(r))
|
||||
return json.Marshal((wireResourceContents)(*r))
|
||||
}
|
||||
// Blob.
|
||||
if r.Text != "" {
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ type EventStore interface {
|
|||
// with all of its streams.
|
||||
// A store cannot rely on this method being called for cleanup. It should institute
|
||||
// additional mechanisms, such as timeouts, to reclaim storage.
|
||||
//
|
||||
SessionClosed(_ context.Context, sessionID string) error
|
||||
|
||||
// There is no StreamClosed method. A server doesn't know when a stream is finished, because
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
// Optional annotations for the client. The client can use annotations to inform
|
||||
// how objects are used or displayed
|
||||
// how objects are used or displayed.
|
||||
type Annotations struct {
|
||||
// Describes who the intended customer of this object or data is.
|
||||
//
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/yosida95/uritemplate/v3"
|
||||
)
|
||||
|
||||
// DefaultPageSize is the default for [ServerOptions.PageSize].
|
||||
const DefaultPageSize = 1000
|
||||
|
||||
// A Server is an instance of an MCP server.
|
||||
|
|
|
|||
|
|
@ -453,13 +453,13 @@ func clientRequestFor[P Params](s *ClientSession, p P) *ClientRequest[P] {
|
|||
|
||||
// Params is a parameter (input) type for an MCP call or notification.
|
||||
type Params interface {
|
||||
// isParams discourages implementation of Params outside of this package.
|
||||
isParams()
|
||||
|
||||
// GetMeta returns metadata from a value.
|
||||
GetMeta() map[string]any
|
||||
// SetMeta sets the metadata on a value.
|
||||
SetMeta(map[string]any)
|
||||
|
||||
// isParams discourages implementation of Params outside of this package.
|
||||
isParams()
|
||||
}
|
||||
|
||||
// RequestParams is a parameter (input) type for an MCP request.
|
||||
|
|
|
|||
Loading…
Reference in a new issue