Documentation
¶
Index ¶
- func ToolResultJSON(res *mcp.CallToolResult) ([]byte, error)
- func ToolResultText(res *mcp.CallToolResult) string
- type Session
- func (s *Session) CallTool(ctx context.Context, name string, args map[string]any) (*mcp.CallToolResult, error)
- func (s *Session) Close() error
- func (s *Session) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
- func (s *Session) ListPrompts(ctx context.Context) ([]*mcp.Prompt, error)
- func (s *Session) ListResources(ctx context.Context) ([]*mcp.Resource, error)
- func (s *Session) ListTools(ctx context.Context) ([]*mcp.Tool, error)
- func (s *Session) ReadResource(ctx context.Context, uri string) (*mcp.ReadResourceResult, error)
- func (s *Session) ServerInfo() *mcp.Implementation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToolResultJSON ¶
func ToolResultJSON(res *mcp.CallToolResult) ([]byte, error)
ToolResultJSON extracts structured content as JSON bytes from a CallToolResult.
func ToolResultText ¶
func ToolResultText(res *mcp.CallToolResult) string
ToolResultText extracts the text content from a CallToolResult.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session wraps an MCP client session with connection metadata.
func ConnectInProcess ¶
ConnectInProcess creates an in-process MCP client session connected to the given redant command tree. The server runs in a goroutine.
func ConnectStdio ¶
ConnectStdio creates an MCP client session connected to an external command via stdio transport.
func (*Session) CallTool ¶
func (s *Session) CallTool(ctx context.Context, name string, args map[string]any) (*mcp.CallToolResult, error)
CallTool invokes a tool by name with the given arguments.
func (*Session) GetPrompt ¶
func (s *Session) GetPrompt(ctx context.Context, name string, args map[string]string) (*mcp.GetPromptResult, error)
GetPrompt gets a prompt by name with arguments.
func (*Session) ListPrompts ¶
ListPrompts returns all prompts exposed by the server.
func (*Session) ListResources ¶
ListResources returns all resources exposed by the server.
func (*Session) ReadResource ¶
ReadResource reads a resource by URI.
func (*Session) ServerInfo ¶
func (s *Session) ServerInfo() *mcp.Implementation
ServerInfo returns the server implementation info from initialization.