Documentation
¶
Index ¶
- type APIError
- type ActivityFilterParams
- type AddServerRequest
- type AddServerResult
- type BulkOperationResult
- type CallToolResult
- type Client
- func (c *Client) AddServer(ctx context.Context, req *AddServerRequest) (*AddServerResult, error)
- func (c *Client) CallTool(ctx context.Context, toolName string, args map[string]interface{}) (*CallToolResult, error)
- func (c *Client) CodeExec(ctx context.Context, code string, input map[string]interface{}, timeoutMS int, ...) (*CodeExecResult, error)
- func (c *Client) DisableAll(ctx context.Context) (*BulkOperationResult, error)
- func (c *Client) EnableAll(ctx context.Context) (*BulkOperationResult, error)
- func (c *Client) GetActivityDetail(ctx context.Context, activityID string) (map[string]interface{}, error)
- func (c *Client) GetActivitySummary(ctx context.Context, period, groupBy string) (map[string]interface{}, error)
- func (c *Client) GetDiagnostics(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetInfo(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetInfoWithRefresh(ctx context.Context, refresh bool) (map[string]interface{}, error)
- func (c *Client) GetServerLogs(ctx context.Context, serverName string, tail int) ([]contracts.LogEntry, error)
- func (c *Client) GetServerTools(ctx context.Context, serverName string) ([]map[string]interface{}, error)
- func (c *Client) GetServers(ctx context.Context) ([]map[string]interface{}, error)
- func (c *Client) ListActivities(ctx context.Context, filter ActivityFilterParams) ([]map[string]interface{}, int, error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) RemoveServer(ctx context.Context, serverName string) error
- func (c *Client) RestartAll(ctx context.Context) (*BulkOperationResult, error)
- func (c *Client) ServerAction(ctx context.Context, serverName, action string) error
- func (c *Client) TriggerOAuthLogin(ctx context.Context, serverName string) error
- func (c *Client) TriggerOAuthLogout(ctx context.Context, serverName string) error
- type CodeExecError
- type CodeExecResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"error"`
RequestID string `json:"request_id,omitempty"`
}
APIError represents an error from the API that includes request_id for log correlation. T023: Added for CLI error display with request ID
func (*APIError) FormatWithRequestID ¶
FormatWithRequestID returns a formatted error message including the request ID.
func (*APIError) HasRequestID ¶
HasRequestID returns true if the error has a request ID for log correlation.
type ActivityFilterParams ¶
ActivityFilterParams contains options for filtering activity records.
type AddServerRequest ¶
type AddServerRequest struct {
Name string `json:"name"`
URL string `json:"url,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
Protocol string `json:"protocol,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Quarantined *bool `json:"quarantined,omitempty"`
}
AddServerRequest represents the request body for adding a server.
type AddServerResult ¶
type AddServerResult struct {
Name string `json:"name"`
ID int `json:"id"`
Quarantined bool `json:"quarantined"`
}
AddServerResult represents the result of adding a server.
type BulkOperationResult ¶
type BulkOperationResult struct {
Total int `json:"total"`
Successful int `json:"successful"`
Failed int `json:"failed"`
Errors map[string]string `json:"errors"`
}
BulkOperationResult holds the results of a bulk operation across multiple servers.
type CallToolResult ¶
type CallToolResult struct {
Content []interface{} `json:"content"`
IsError bool `json:"isError"`
Metadata map[string]interface{} `json:"_meta,omitempty"`
}
CallToolResult represents tool call result.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides HTTP API access for CLI commands.
func NewClient ¶
func NewClient(endpoint string, logger *zap.SugaredLogger) *Client
NewClient creates a new CLI HTTP client. If endpoint is a socket path, creates a client with socket dialer.
func NewClientWithAPIKey ¶
func NewClientWithAPIKey(endpoint, apiKey string, logger *zap.SugaredLogger) *Client
NewClientWithAPIKey creates a new CLI HTTP client with API key authentication. If endpoint is a socket path, creates a client with socket dialer.
func (*Client) AddServer ¶
func (c *Client) AddServer(ctx context.Context, req *AddServerRequest) (*AddServerResult, error)
AddServer adds a new upstream server via the daemon API.
func (*Client) CallTool ¶
func (c *Client) CallTool( ctx context.Context, toolName string, args map[string]interface{}, ) (*CallToolResult, error)
CallTool calls a tool on an upstream server via daemon API.
func (*Client) CodeExec ¶
func (c *Client) CodeExec( ctx context.Context, code string, input map[string]interface{}, timeoutMS int, maxToolCalls int, allowedServers []string, ) (*CodeExecResult, error)
CodeExec executes JavaScript code via the daemon API.
func (*Client) DisableAll ¶
func (c *Client) DisableAll(ctx context.Context) (*BulkOperationResult, error)
T080: DisableAll disables all configured servers.
func (*Client) EnableAll ¶
func (c *Client) EnableAll(ctx context.Context) (*BulkOperationResult, error)
T080: EnableAll enables all configured servers.
func (*Client) GetActivityDetail ¶
func (c *Client) GetActivityDetail(ctx context.Context, activityID string) (map[string]interface{}, error)
GetActivityDetail retrieves details for a specific activity record.
func (*Client) GetActivitySummary ¶
func (c *Client) GetActivitySummary(ctx context.Context, period, groupBy string) (map[string]interface{}, error)
GetActivitySummary retrieves activity summary statistics.
func (*Client) GetDiagnostics ¶
GetDiagnostics retrieves diagnostics information from daemon.
func (*Client) GetInfoWithRefresh ¶
func (c *Client) GetInfoWithRefresh(ctx context.Context, refresh bool) (map[string]interface{}, error)
GetInfoWithRefresh retrieves server info with optional update check refresh. When refresh is true, forces an immediate update check against GitHub.
func (*Client) GetServerLogs ¶
func (c *Client) GetServerLogs(ctx context.Context, serverName string, tail int) ([]contracts.LogEntry, error)
GetServerLogs retrieves logs for a specific server.
func (*Client) GetServerTools ¶
func (c *Client) GetServerTools(ctx context.Context, serverName string) ([]map[string]interface{}, error)
GetServerTools retrieves tools for a specific server from daemon.
func (*Client) GetServers ¶
GetServers retrieves list of servers from daemon.
func (*Client) ListActivities ¶
func (c *Client) ListActivities(ctx context.Context, filter ActivityFilterParams) ([]map[string]interface{}, int, error)
ListActivities retrieves activity records with filtering.
func (*Client) RemoveServer ¶
RemoveServer removes an upstream server via the daemon API.
func (*Client) RestartAll ¶
func (c *Client) RestartAll(ctx context.Context) (*BulkOperationResult, error)
T079: RestartAll restarts all configured servers.
func (*Client) ServerAction ¶
ServerAction performs an action on a server (enable, disable, restart).
func (*Client) TriggerOAuthLogin ¶
TriggerOAuthLogin initiates OAuth authentication flow for a server. Returns *contracts.OAuthFlowError for structured OAuth errors (Spec 020).
type CodeExecError ¶
CodeExecError represents execution error.
type CodeExecResult ¶
type CodeExecResult struct {
OK bool `json:"ok"`
Result interface{} `json:"result,omitempty"`
Error *CodeExecError `json:"error,omitempty"`
Stats map[string]interface{} `json:"stats,omitempty"`
RequestID string `json:"request_id,omitempty"` // T023: For error correlation
}
CodeExecResult represents code execution result.