Documentation
¶
Overview ¶
Package framework provides a lightweight scenario runner used by the integration tests to launch the example server and exercise MCP scenarios.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportsServer ¶
func SupportsServer() bool
SupportsServer reports whether the integration framework can reach a server.
Types ¶
type Defaults ¶
type Defaults struct {
Client string `yaml:"client"` // e.g., "jsonrpc.mcp_assistant" (hint to pick generated client)
Headers map[string]string `yaml:"headers"` // default headers for all steps
ClientMode string `yaml:"client_mode"` // http | cli (optional)
}
Defaults apply to steps when not explicitly set in a step.
type Expect ¶
type Expect struct {
Status string `yaml:"status"` // success | error | no_response
Error *ExpectedError `yaml:"error"`
Result map[string]any `yaml:"result"`
}
Expect describes non-streaming expectations.
type ExpectRetry ¶
type ExpectRetry struct {
PromptContains string `yaml:"prompt_contains"`
Contains []string `yaml:"contains"`
}
ExpectRetry describes retry expectations for generated client mode
type ExpectedError ¶
ExpectedError captures expected JSON-RPC error.
type Pre ¶
type Pre struct {
AutoInitialize *bool `yaml:"auto_initialize"` // default true
}
Pre controls scenario-level behavior (e.g., auto-initialize handshake).
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner runs scenarios against the generated example server.
type Scenario ¶
type Scenario struct {
Name string `yaml:"name"`
Defaults *Defaults `yaml:"defaults"`
Pre *Pre `yaml:"pre"`
Steps []Step `yaml:"steps"`
}
Scenario models a test scenario (new multi-step form only).
func LoadScenarios ¶
LoadScenarios loads scenarios from a YAML file path.
type Step ¶
type Step struct {
Name string `yaml:"name"`
Client string `yaml:"client"` // overrides defaults.client
Op string `yaml:"op"` // generated endpoint method name, e.g., "ToolsCall"
Input map[string]any `yaml:"input"` // maps to payload fields
Headers map[string]string `yaml:"headers"` // per-step headers (e.g., Accept)
Notification bool `yaml:"notification"` // send as JSON-RPC notification (no id)
Expect *Expect `yaml:"expect"`
StreamExpect *StreamExpect `yaml:"stream_expect"`
ExpectRetry *ExpectRetry `yaml:"expect_retry"` // generated client retry expectation
}
Step defines a single operation invocation using a generated client.
type StreamEventExp ¶
StreamEventExp matches SSE event/data partially.
type StreamExpect ¶
type StreamExpect struct {
MinEvents int `yaml:"min_events"`
TimeoutMS int `yaml:"timeout_ms"`
Events []StreamEventExp `yaml:"events"`
}
StreamExpect describes streaming expectations.