Documentation
¶
Overview ¶
Package mcp provides an MCP (Model Context Protocol) server for the Tapes system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// SpanSearcher runs semantic search over the span-embedding
// projection (main llm spans, delta-only content) — the same search
// the HTTP /v1/search/spans surface uses.
SpanSearcher SpanSearcher
// Embedder converts the query text to a vector for SpanSearcher.
Embedder embeddings.Embedder
// Noop for empty MCP server
Noop bool
// Logger is the configured logger
Logger *slog.Logger
}
type SearchInput ¶
type SearchInput struct {
Query string `json:"query" jsonschema:"the search query text to find relevant spans"`
TopK int `json:"top_k,omitempty" jsonschema:"number of results to return (default: 5)"`
}
SearchInput represents the input arguments for the MCP search tool. It uses jsonschema tags specific to the MCP protocol.
type SearchOutput ¶ added in v0.16.0
type SearchOutput struct {
Query string `json:"query"`
Results []SearchResult `json:"results"`
Count int `json:"count"`
}
SearchOutput is the MCP search response. It mirrors the HTTP /v1/search/spans response shape (api.SpanSearchOutput).
type SearchResult ¶ added in v0.16.0
type SearchResult struct {
SessionID string `json:"session_id,omitempty" jsonschema:"session the span belongs to"`
TraceID string `json:"trace_id" jsonschema:"trace (turn) the span belongs to"`
SpanID string `json:"span_id" jsonschema:"the matched span"`
Score float32 `json:"score" jsonschema:"vector similarity score"`
// UserPrompt is the prompt of the turn (trace) the span belongs to.
UserPrompt string `json:"user_prompt,omitempty" jsonschema:"prompt of the turn the span belongs to"`
// Snippet previews the matched span's delta-only text.
Snippet string `json:"snippet,omitempty" jsonschema:"preview of the matched span's text"`
Model string `json:"model,omitempty" jsonschema:"model that produced the span"`
StartedAt time.Time `json:"started_at" jsonschema:"when the span started"`
}
SearchResult is one span hit with its trace/turn context. It mirrors the HTTP /v1/search/spans response shape (api.SpanSearchResult).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type SpanSearcher ¶ added in v0.16.0
type SpanSearcher interface {
Search(ctx context.Context, orgID string, embedding []float32, topK int) ([]spanembed.Hit, error)
}
SpanSearcher performs vector-similarity search over span embeddings. *spanembed.Store implements it; it is the exact same search path the HTTP GET /v1/search/spans handler uses. Defined here (rather than imported from package api) so the MCP server reuses the span search without creating an import cycle with package api.