client

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(name, version string, transport transport.Transport, options ...Option) *Client

func (*Client) CallTool

func (*Client) Complete

func (*Client) GetPrompt

func (*Client) Initialize

func (c *Client) Initialize(ctx context.Context) (*schema.InitializeResult, error)

func (*Client) ListPrompts

func (c *Client) ListPrompts(ctx context.Context, cursor *string) (*schema.ListPromptsResult, error)

func (*Client) ListResourceTemplates

func (c *Client) ListResourceTemplates(ctx context.Context, cursor *string) (*schema.ListResourceTemplatesResult, error)

func (*Client) ListResources

func (c *Client) ListResources(ctx context.Context, cursor *string) (*schema.ListResourcesResult, error)

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context, cursor *string) (*schema.ListToolsResult, error)

func (*Client) Ping

func (*Client) ReadResource

func (*Client) SetLevel

func (*Client) Subscribe

func (*Client) Unsubscribe

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func (*Handler) CreateMessageRequest

func (h *Handler) CreateMessageRequest(ctx context.Context, request *jsonrpc.Request) (*schema.CreateMessageResult, *jsonrpc.Error)

CreateMessageRequest handles the sampling/createMessage method

func (*Handler) ListRoots

func (h *Handler) ListRoots(ctx context.Context, request *jsonrpc.Request) (*schema.ListRootsResult, *jsonrpc.Error)

ListRoots handles the root/listRoots method

func (*Handler) OnNotification

func (h *Handler) OnNotification(ctx context.Context, notification *jsonrpc.Notification)

OnNotification handles notification

func (*Handler) Serve

func (h *Handler) Serve(ctx context.Context, request *jsonrpc.Request, response *jsonrpc.Response)

type Implementer

type Implementer interface {
	Operations

	OnNotification(ctx context.Context, notification *jsonrpc.Notification)

	// Implements checks if the method is implemented
	Implements(method string) bool
}

type Operations

type Operations interface {
	ListRoots(ctx context.Context, params *schema.ListRootsRequestParams) (*schema.ListRootsResult, *jsonrpc.Error)
	CreateMessage(ctx context.Context, params *schema.CreateMessageRequestParams) (*schema.CreateMessageResult, *jsonrpc.Error)
}

type Option

type Option func(c *Client)

Option represents option

func WithCapabilities

func WithCapabilities(capabilities schema.ClientCapabilities) Option

WithCapabilities set capabilites

func WithMetadata

func WithMetadata(metadata map[string]any) Option

WithMetadata with meta

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL