Help us shape the future of Go! Take the 2026 Go Developer Survey

mcp

package
v1.0.1 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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ToolManage  = "mcp_manage"
	ToolSearch  = "mcp_tool_search"
	ToolInspect = "mcp_tool_inspect"
	ToolCall    = "mcp_tool_call"
)

Variables

This section is empty.

Functions

func InputSchema added in v0.8.2

func InputSchema(name string) (map[string]any, bool)

func OutputSchema added in v0.8.2

func OutputSchema(name string) (map[string]any, bool)

Types

type CallRequest added in v0.8.2

type CallRequest struct {
	Name      string         `json:"name"`
	Arguments map[string]any `json:"arguments"`
}

CallRequest.Arguments 是第三方 MCP 工具 schema 决定的动态叶子,必须保持开放对象。

type CapabilityItem added in v0.8.2

type CapabilityItem struct {
	Name          string
	DisplayName   string
	Description   string
	SourceType    string
	PluginName    string
	Status        string
	ToolCount     int
	LastErrorCode string
}

type InspectRequest added in v0.8.2

type InspectRequest struct {
	Name string `json:"name"`
}

type ManageRequest added in v0.8.2

type ManageRequest struct {
	Action      string            `json:"action"`
	Name        string            `json:"name,omitempty"`
	Description string            `json:"description,omitempty"`
	Transport   string            `json:"transport,omitempty"`
	URL         string            `json:"url,omitempty"`
	Command     string            `json:"command,omitempty"`
	Args        []string          `json:"args,omitempty"`
	CWD         string            `json:"cwd,omitempty"`
	HeaderEnv   map[string]string `json:"header_env,omitempty"`
	EnvFromEnv  map[string]string `json:"env_from_env,omitempty"`
	Key         string            `json:"key,omitempty"`
	Value       *string           `json:"value,omitempty"`
	Enabled     *bool             `json:"enabled,omitempty"`
	TimeoutMS   *int              `json:"timeout_ms,omitempty"`
	CallbackID  string            `json:"callback_id,omitempty"`
}

ManageRequest 是 mcp_manage 进入动态 MCP capability 后的稳定输入契约。

type Result

type Result = toolcore.Result

type SearchRequest added in v0.8.2

type SearchRequest struct {
	Query  string `json:"query"`
	Server string `json:"server,omitempty"`
	Limit  *int   `json:"limit,omitempty"`
}

type Service

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

func New

func New(manager *mcpclient.Manager, envs *envstore.Store) *Service

func (*Service) Call

func (s *Service) Call(ctx context.Context, request CallRequest) (Result, error)

func (*Service) CapabilityItems added in v0.8.2

func (s *Service) CapabilityItems() []CapabilityItem

func (*Service) Close added in v0.8.2

func (s *Service) Close() error

func (*Service) DeliverOAuthCallback added in v0.9.1

func (s *Service) DeliverOAuthCallback(result oauthclient.CallbackResult) error

func (*Service) Inspect

func (s *Service) Inspect(ctx context.Context, request InspectRequest) (Result, error)

func (*Service) Manage

func (s *Service) Manage(ctx context.Context, request ManageRequest) (Result, error)

func (*Service) RemoveOAuthCallback added in v0.9.1

func (s *Service) RemoveOAuthCallback(id string)

func (*Service) RemoveOAuthGrant added in v0.9.1

func (s *Service) RemoveOAuthGrant(storageKey string) error

func (*Service) RuntimeCount added in v1.0.0

func (s *Service) RuntimeCount() int

func (*Service) Search

func (s *Service) Search(ctx context.Context, request SearchRequest) (Result, error)

func (*Service) SetOAuthCallback added in v0.9.1

func (s *Service) SetOAuthCallback(option oauthclient.CallbackOption) error

type ToolError

type ToolError = toolcore.ToolError

Jump to

Keyboard shortcuts

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