Documentation
¶
Overview ¶
Package client owns protocol-native Model Context Protocol connections, transports, tool discovery, and tool calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Expand ¶
Expand resolves workspace and environment references used by MCP transport configuration.
func ExpandHome ¶
ExpandHome resolves a leading tilde in an MCP path.
Types ¶
type Config ¶
type Config struct {
Command string
Args []string
Env map[string]string
Cwd string
URL string
Headers map[string]string
TimeoutSeconds int
}
Config contains only the transport fields needed to connect one MCP server. Product concerns such as enablement and workspace visibility stay above the protocol client.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection owns one initialized MCP client session and its discovered tools. Product-level managers can share it without depending on protocol internals.
func Connect ¶
func Connect(ctx context.Context, name string, config Config, workspace string) (*Connection, error)
Connect initializes one server and discovers its complete tools/list result. Workspace scoping is a product concern and must be checked by the caller.
func (*Connection) Close ¶
func (connection *Connection) Close()
Close gracefully terminates the protocol session. It is idempotent.
func (*Connection) Diagnostic ¶
func (connection *Connection) Diagnostic() string
Diagnostic reports non-fatal tool definition problems found at startup.
func (*Connection) Name ¶
func (connection *Connection) Name() string
Name returns the configured server name used for tool names and diagnostics.
func (*Connection) Tools ¶
func (connection *Connection) Tools() []Tool
Tools returns an independent slice of the tools discovered at initialization.
func (*Connection) Transport ¶
func (connection *Connection) Transport() string
Transport returns stdio or streamable_http.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is one tool discovered from an MCP server. It retains the protocol definition and connection needed to call the original server without depending on Or's agent, provider, or permission types.
func (Tool) Call ¶
Call invokes the tool with protocol-native arguments and returns the protocol-native result.
func (Tool) Definition ¶
Definition returns the MCP protocol definition advertised by the server. Callers must treat the returned definition as read-only.
func (Tool) ServerName ¶
ServerName returns the configured name of the server that owns the tool.