mcp

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultMaxResults = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ConfigPath string `json:"config_path,omitempty"`
	LocalOnly  bool   `json:"local_only"`
	Source     string `json:"source"`
	MaxResults int    `json:"max_results"`
}

func ParseConfig

func ParseConfig(configPath string, localOnly bool, maxResults int, opts ...ConfigOption) (Config, error)

type ConfigOption

type ConfigOption func(*Config)

func WithSource

func WithSource(source string) ConfigOption

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string     `json:"protocolVersion"`
	ServerInfo      ServerInfo `json:"serverInfo"`
	Capabilities    ServerCaps `json:"capabilities"`
}

type ListConversationsInput

type ListConversationsInput struct {
	AccountIDs   []string `json:"account_ids,omitempty"`
	Limit        int      `json:"limit,omitempty"`
	Offset       int      `json:"offset,omitempty"`
	UnreadOnly   bool     `json:"unread_only,omitempty"`
	IncludeMuted bool     `json:"include_muted,omitempty"`
	MutedOnly    bool     `json:"muted_only,omitempty"`
	PinnedOnly   bool     `json:"pinned_only,omitempty"`
	ArchivedOnly bool     `json:"archived_only,omitempty"`
	Type         string   `json:"type,omitempty"`
}

type ListConversationsOutput

type ListConversationsOutput struct {
	Conversations []api.Chat `json:"conversations"`
	Total         int        `json:"total"`
	HasMore       bool       `json:"has_more,omitempty"`
}

type ReadMessagesInput

type ReadMessagesInput struct {
	ChatID string `json:"chat_id"`
	Limit  int    `json:"limit,omitempty"`
}

type ReadMessagesOutput

type ReadMessagesOutput struct {
	ChatID     string        `json:"chat_id"`
	ThreadName string        `json:"thread_name,omitempty"`
	Messages   []api.Message `json:"messages"`
	HasMore    bool          `json:"has_more,omitempty"`
	NextCursor string        `json:"next_cursor,omitempty"`
}

type Request

type Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

type Response

type Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      json.RawMessage `json:"id,omitempty"`
	Result  any             `json:"result,omitempty"`
	Error   *ResponseError  `json:"error,omitempty"`
}

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type SearchMessagesInput

type SearchMessagesInput struct {
	Query      string   `json:"query"`
	ChatIDs    []string `json:"chat_ids,omitempty"`
	AccountIDs []string `json:"account_ids,omitempty"`
	Sender     string   `json:"sender,omitempty"`
	ChatType   string   `json:"chat_type,omitempty"`
	Limit      int      `json:"limit,omitempty"`
}

type SearchMessagesOutput

type SearchMessagesOutput struct {
	Query    string              `json:"query"`
	Messages []api.Message       `json:"messages"`
	Chats    map[string]api.Chat `json:"chats,omitempty"`
	HasMore  bool                `json:"has_more,omitempty"`
	Cursor   string              `json:"cursor,omitempty"`
}

type Server

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

func NewServer

func NewServer(cfg Config, opts ...ServerOption) *Server

func (*Server) CallTool

func (s *Server) CallTool(ctx context.Context, params ToolCallParams) (ToolCallResult, error)

func (*Server) Handle

func (s *Server) Handle(req Request) Response

func (*Server) ListTools

func (s *Server) ListTools() []Tool

func (*Server) Serve

func (s *Server) Serve(r io.Reader, w io.Writer) error

type ServerCaps

type ServerCaps struct {
	Tools ToolsCapability `json:"tools"`
}

type ServerInfo

type ServerInfo struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

type ServerOption

type ServerOption func(*Server)

func WithContext

func WithContext(ctx context.Context) ServerOption

func WithToolRuntime

func WithToolRuntime(runtime ToolRuntime) ServerOption

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	InputSchema map[string]any `json:"inputSchema,omitempty"`
}

type ToolCallParams

type ToolCallParams struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments,omitempty"`
}

type ToolCallResult

type ToolCallResult struct {
	Content []ToolContent `json:"content,omitempty"`
	IsError bool          `json:"isError,omitempty"`
}

type ToolContent

type ToolContent struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

type ToolsCapability

type ToolsCapability struct {
	ListChanged bool `json:"listChanged"`
}

type ToolsListResult

type ToolsListResult struct {
	Tools []Tool `json:"tools"`
}

Jump to

Keyboard shortcuts

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