Documentation
¶
Index ¶
- Variables
- func CollapseSuccessful(messages []store.LogMessage) []store.LogMessage
- func DedupMessages(messages []store.LogMessage) []store.LogMessage
- func FormatMessages(messages []store.LogMessage) string
- func FormatMessagesRaw(messages []store.LogMessage) string
- func TruncateMessages(messages []store.LogMessage, maxLines int) []store.LogMessage
- type CallToolParams
- type CallToolResult
- type Capabilities
- type ContentBlock
- type DrainSource
- type Error
- type InitializeResult
- type InputSchema
- type Property
- type Request
- type Response
- type Server
- type ServerInfo
- type Tool
- type ToolsCapability
- type ToolsListResult
Constants ¶
This section is empty.
Variables ¶
var ServerVersion = "dev"
ServerVersion can be set by the caller to match the binary version.
Functions ¶
func CollapseSuccessful ¶ added in v0.1.6
func CollapseSuccessful(messages []store.LogMessage) []store.LogMessage
CollapseSuccessful replaces the output of successful build runs (exit code 0) with a single-line summary to reduce context token consumption.
A "run" is a sequence of messages sharing the same tag, bounded by an exit code message. When the same tag appears in multiple runs within a single drain window (e.g. a failed build followed by a successful rebuild), each run is evaluated independently — only runs with exit code 0 are collapsed. Runs with non-zero exit code or no exit code are returned unchanged.
func DedupMessages ¶ added in v0.1.4
func DedupMessages(messages []store.LogMessage) []store.LogMessage
DedupMessages removes duplicate messages across sources. Dedup key: sha256(timestamp_micros + tag + stream + content)[:16]. Earlier messages (local) take priority over later ones (configured).
func FormatMessages ¶
func FormatMessages(messages []store.LogMessage) string
FormatMessages converts log messages into a human-readable string.
func FormatMessagesRaw ¶ added in v0.1.5
func FormatMessagesRaw(messages []store.LogMessage) string
FormatMessagesRaw outputs raw lines without [devtap: tag] headers. Messages are separated by blank lines.
func TruncateMessages ¶
func TruncateMessages(messages []store.LogMessage, maxLines int) []store.LogMessage
TruncateMessages applies line-level truncation across messages. It allocates the maxLines budget proportionally to each message, using filter.Truncate for tail-biased truncation per message.
Types ¶
type CallToolParams ¶
type CallToolParams struct {
Name string `json:"name"`
Arguments map[string]any `json:"arguments,omitempty"`
}
CallToolParams holds parameters for tools/call.
type CallToolResult ¶
type CallToolResult struct {
Content []ContentBlock `json:"content"`
IsError bool `json:"isError,omitempty"`
}
CallToolResult is returned for tools/call.
type Capabilities ¶
type Capabilities struct {
Tools *ToolsCapability `json:"tools,omitempty"`
}
Capabilities declares what the server supports.
type ContentBlock ¶
ContentBlock holds tool output.
type DrainSource ¶ added in v0.1.4
type DrainSource struct {
Store store.Store
SessionID string
Label string // e.g. "local" or the explicit session name
}
DrainSource represents a single source from which the MCP server drains messages.
type InitializeResult ¶
type InitializeResult struct {
ProtocolVersion string `json:"protocolVersion"`
Capabilities Capabilities `json:"capabilities"`
ServerInfo ServerInfo `json:"serverInfo"`
}
InitializeResult is returned for initialize requests.
type InputSchema ¶
type InputSchema struct {
Type string `json:"type"`
Properties map[string]Property `json:"properties,omitempty"`
}
InputSchema is a JSON Schema for tool inputs.
type Request ¶
type Request struct {
JSONRPC string `json:"jsonrpc"`
ID any `json:"id,omitempty"` // may be absent for notifications
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request represents a JSON-RPC 2.0 request.
type Response ¶
type Response struct {
JSONRPC string `json:"jsonrpc"`
ID any `json:"id"`
Result any `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Response represents a JSON-RPC 2.0 response.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements an MCP stdio server that exposes devtap tools.
func NewMultiSourceServer ¶ added in v0.1.4
func NewMultiSourceServer(sources []DrainSource, maxLines int) *Server
NewMultiSourceServer creates a new MCP server with multiple drain sources.
func NewServer ¶
NewServer creates a new MCP server with a single drain source (backward compatible).
type ServerInfo ¶
ServerInfo provides server metadata.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema InputSchema `json:"inputSchema"`
}
Tool describes a callable tool.
type ToolsCapability ¶
type ToolsCapability struct {
ListChanged bool `json:"listChanged,omitempty"`
}
ToolsCapability indicates tool support.
type ToolsListResult ¶
type ToolsListResult struct {
Tools []Tool `json:"tools"`
}
ToolsListResult is returned for tools/list.