Documentation
¶
Index ¶
- Constants
- func SetGlobalConnection(conn *config.ConnectionConfig)
- type BaseCommand
- func (c *BaseCommand) CloseClient() error
- func (c *BaseCommand) CreateClient(cmd *cobra.Command) error
- func (c *BaseCommand) GetOutputFormat() OutputFormat
- func (c *BaseCommand) GetService() mcp.Service
- func (c *BaseCommand) HandleError(err error, operation string) error
- func (c *BaseCommand) PostRunE(cmd *cobra.Command, args []string) error
- func (c *BaseCommand) PreRunE(cmd *cobra.Command, args []string) error
- func (c *BaseCommand) SetOutputFormat(cmd *cobra.Command) error
- func (c *BaseCommand) ValidateConnection() error
- func (c *BaseCommand) WithContext() (context.Context, context.CancelFunc)
- func (c *BaseCommand) WithTimeout(timeout time.Duration) *BaseCommand
- type OutputFormat
- type PromptCommand
- type ResourceCommand
- type ServerCommand
- type ToolCommand
Constants ¶
const ( FormatText = "text" FormatJSON = "json" )
Output format constants
const ( ConnectionCreating = "🔄 Creating MCP service...\n" ConnectionStarting = "🚀 Starting process: %s %s\n" ConnectionConnecting = "🌐 Connecting to URL: %s\n" ConnectionTimeout = "⏳ Establishing connection (timeout: %s)...\n" ConnectionSuccess = "✅ Connected successfully\n" ConnectionFailed = "❌ Connection failed\n" )
Connection message constants
Variables ¶
This section is empty.
Functions ¶
func SetGlobalConnection ¶
func SetGlobalConnection(conn *config.ConnectionConfig)
SetGlobalConnection sets the global connection config
Types ¶
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand provides common functionality for all CLI commands
func (*BaseCommand) CloseClient ¶
func (c *BaseCommand) CloseClient() error
CloseClient properly closes the MCP client
func (*BaseCommand) CreateClient ¶
func (c *BaseCommand) CreateClient(cmd *cobra.Command) error
CreateClient creates and initializes an MCP client
func (*BaseCommand) GetOutputFormat ¶
func (c *BaseCommand) GetOutputFormat() OutputFormat
GetOutputFormat returns the current output format
func (*BaseCommand) GetService ¶
func (c *BaseCommand) GetService() mcp.Service
GetService returns the MCP service
func (*BaseCommand) HandleError ¶
func (c *BaseCommand) HandleError(err error, operation string) error
HandleError provides consistent error handling across commands
func (*BaseCommand) PostRunE ¶
func (c *BaseCommand) PostRunE(cmd *cobra.Command, args []string) error
PostRunE is a common post-run function that cleans up the client
func (*BaseCommand) PreRunE ¶
func (c *BaseCommand) PreRunE(cmd *cobra.Command, args []string) error
PreRunE is a common pre-run function that sets up the client
func (*BaseCommand) SetOutputFormat ¶
func (c *BaseCommand) SetOutputFormat(cmd *cobra.Command) error
SetOutputFormat sets the output format for the command
func (*BaseCommand) ValidateConnection ¶
func (c *BaseCommand) ValidateConnection() error
ValidateConnection checks if the client is connected
func (*BaseCommand) WithContext ¶
func (c *BaseCommand) WithContext() (context.Context, context.CancelFunc)
WithContext creates a context with timeout for the command
func (*BaseCommand) WithTimeout ¶
func (c *BaseCommand) WithTimeout(timeout time.Duration) *BaseCommand
WithTimeout sets the command timeout
type OutputFormat ¶
type OutputFormat string
OutputFormat represents supported output formats
const ( OutputFormatText OutputFormat = "text" OutputFormatJSON OutputFormat = "json" )
type PromptCommand ¶
type PromptCommand struct {
*BaseCommand
}
PromptCommand handles prompt-related CLI operations
func NewPromptCommand ¶
func NewPromptCommand() *PromptCommand
NewPromptCommand creates a new prompt command
func (*PromptCommand) CreateCommand ¶
func (pc *PromptCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for prompts
type ResourceCommand ¶
type ResourceCommand struct {
*BaseCommand
}
ResourceCommand handles resource-related CLI operations
func NewResourceCommand ¶
func NewResourceCommand() *ResourceCommand
NewResourceCommand creates a new resource command
func (*ResourceCommand) CreateCommand ¶
func (rc *ResourceCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for resources
type ServerCommand ¶
type ServerCommand struct {
BaseCommand
}
ServerCommand handles server information operations
func NewServerCommand ¶
func NewServerCommand() *ServerCommand
NewServerCommand creates a new server command
func (*ServerCommand) CreateCommand ¶
func (c *ServerCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command
type ToolCommand ¶
type ToolCommand struct {
*BaseCommand
}
ToolCommand handles tool-related CLI operations
func (*ToolCommand) CreateCommand ¶
func (tc *ToolCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for tools