mcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 27 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 (*Client) CallTool

func (c *Client) CallTool(ctx context.Context, name string, args map[string]any) (*protocol.CallToolResult, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Instructions

func (c *Client) Instructions() string

func (*Client) ListTools

func (c *Client) ListTools(ctx context.Context) ([]*protocol.Tool, error)

func (*Client) Name

func (c *Client) Name() string

type Failure

type Failure struct {
	Server string
	Err    error
	Login  bool // it wants an OAuth login
}

Failure is a server that did not connect.

type Manager

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

func NewManager

func NewManager(onChange func()) *Manager

NewManager calls onChange, on the connection's goroutine, whenever a server's tool list changes.

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Configure

func (m *Manager) Configure(ctx context.Context, servers map[string]config.MCPServer) []Failure

Configure connects only servers that are new, changed or failed before; connected servers whose config is unchanged stay up. Calls must not overlap; the caller serializes them.

func (*Manager) Instructions

func (m *Manager) Instructions() []string

func (*Manager) Login

func (m *Manager) Login(ctx context.Context, name string) (*auth.Login, error)

Login starts an OAuth login to the server name; the caller completes it with Wait and connects again.

func (*Manager) Logout

func (m *Manager) Logout(name string) error

Logout forgets the server's token and disconnects it, so the next Configure connects it again without one.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) []ServerStatus

Status includes failed servers. Tools are listed in parallel without holding the lock.

func (*Manager) Tools

func (m *Manager) Tools(ctx context.Context) ([]agentcore.Tool, map[string]permission.Metadata)

type ServerStatus

type ServerStatus struct {
	Name      string
	ToolCount int
	Error     string // non-empty if connection failed
	Login     bool   // the server wants an OAuth login
	ListError string // non-empty if connected but ListTools failed
}

Jump to

Keyboard shortcuts

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