Documentation
¶
Index ¶
- Constants
- func RedactURL(raw string) string
- func SupportedProtocolVersions() []string
- type CallError
- type CallStage
- type Client
- func (c *Client) CallTool(ctx context.Context, endpoint, tool string, arguments map[string]any) (ToolCallResult, error)
- func (c *Client) Initialize(ctx context.Context, endpoint string) (InitializeResult, error)
- func (c *Client) ListTools(ctx context.Context, endpoint string) (ToolsListResult, error)
- func (c *Client) NotifyInitialized(ctx context.Context, endpoint string) error
- func (c *Client) WithAuth(token string, headers map[string]string) *Client
- func (c *Client) WithExecutionId(executionId string) *Client
- type ContentBlock
- type InitializeResult
- type RPCError
- type SnapshotRecorder
- type ToolCallResult
- type ToolDescriptor
- type ToolsListResult
Constants ¶
View Source
const ( // Security headers HeaderSource = "X-Cli-Source" HeaderVersion = "X-Cli-Version" HeaderExecutionId = "X-Cli-Execution-Id" SourceValue = "dws-cli" )
Variables ¶
This section is empty.
Functions ¶
func SupportedProtocolVersions ¶
func SupportedProtocolVersions() []string
Types ¶
type CallError ¶
type CallError struct {
Stage CallStage
HTTPStatus int
RetryAfter string
TraceID string
RequestID string
RPCCode int
Cause error
}
CallError carries recoverable transport metadata without changing the repository-local structured error contract.
type Client ¶
type Client struct {
HTTPClient *http.Client
MaxRetries int
RetryDelay time.Duration
RetryMaxDelay time.Duration
AuthToken string
ExtraHeaders map[string]string
SnapshotRecorder SnapshotRecorder
TrustedDomains []string
ExecutionId string // Request tracing ID for debugging
FileLogger *slog.Logger // Structured file logger for diagnostics (nil-safe).
// Stderr is the writer for warning messages. Defaults to os.Stderr.
Stderr io.Writer
// contains filtered or unexported fields
}
func (*Client) Initialize ¶
func (*Client) NotifyInitialized ¶
func (*Client) WithAuth ¶
WithAuth returns a shallow copy of c with the given auth token and extra headers. The returned client shares the underlying HTTP client but is safe to use concurrently with the original.
func (*Client) WithExecutionId ¶
WithExecutionId returns a shallow copy of c with the given execution ID. The execution ID is included in requests for tracing and debugging.
type ContentBlock ¶
type InitializeResult ¶
type RPCError ¶
type RPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data json.RawMessage `json:"data,omitempty"`
}
type SnapshotRecorder ¶
type ToolCallResult ¶
type ToolCallResult struct {
Content map[string]any `json:"-"`
StructuredContent map[string]any `json:"structuredContent,omitempty"`
Blocks []ContentBlock `json:"content,omitempty"`
IsError bool `json:"isError,omitempty"`
}
func (*ToolCallResult) UnmarshalJSON ¶
func (r *ToolCallResult) UnmarshalJSON(data []byte) error
type ToolDescriptor ¶
type ToolsListResult ¶
type ToolsListResult struct {
Tools []ToolDescriptor `json:"tools"`
}
Click to show internal directories.
Click to hide internal directories.