Documentation
¶
Overview ¶
Package mcpserver exposes sieve to agents over the Model Context Protocol.
The one rule everything else follows from ¶
An MCP tool result lands directly in the calling agent's context window. If `distill` returned the whole artifact, sieve would have moved the token cost rather than removed it, and the entire premise of the project would fail.
So every tool returns the smallest useful payload and the agent pulls detail only where it needs it. `distill` returns a manifest -- title, summary, section list with sizes, counts -- and never the body. `search_content` returns block ids and short snippets. `get_content` returns a capped slice with a cursor. Nothing returns the artifact.
Why JSON is the default and Markdown is opt-in ¶
Markdown remains an artifact format because a human asked for it. But tool output lands unmediated in a context window, and Markdown has no structural marking that a model reliably treats as data rather than instructions: a heading in extracted text looks exactly like a heading the harness wrote. JSON puts every recovered string inside a labelled field, which is the closest thing to a quoting mechanism available. So JSON is the default here even though Markdown is the friendlier artifact on disk.
Index ¶
Constants ¶
const Instructions = `` /* 1443-byte string literal not displayed */
Instructions is the server-wide guidance sent during initialization.
Some hosts read it as system-level context and at least one truncates its practical attention to the opening characters, so the first two sentences have to stand alone and say the load-bearing things: call distill first, read the manifest, never ask for the whole artifact.
Variables ¶
This section is empty.
Functions ¶
func SurfaceTokens ¶
func SurfaceTokens() int
SurfaceTokens estimates what the tool definitions cost a session.
Exported so the token report can print it beside the per-page figures: the definition cost is paid once and the page cost is paid every time, and a comparison that leaves one of them out is answerable with the other.
Types ¶
type Options ¶
type Options struct {
Distill distill.Options
// CacheTTL is how long a completed artifact is reused for.
CacheTTL time.Duration
// MaxJobs bounds the in-memory job table.
MaxJobs int
Logf func(format string, args ...any)
}
Options configures the server.