mcp: an agent reads the fleet from its own client, out of the same document - #304
Open
sanlee-ys wants to merge 1 commit into
Open
mcp: an agent reads the fleet from its own client, out of the same document#304sanlee-ys wants to merge 1 commit into
sanlee-ys wants to merge 1 commit into
Conversation
…cument `telltale mcp` serves the snapshot document (design.md §7.22) over the Model Context Protocol on stdio. An MCP client starts the process and calls one tool, `fleet_snapshot`, which takes an optional `vendor` argument, runs one scan and returns the document. One flag: `--timeout`, per call. The document is not re-made here. The tool result is `snapshot.Encode` over the document `snapshot.Build` produced from the scan `telltale snapshot` runs, so zero-vs-absent, the explicit nulls, `estimated`, `unsupported` and `self_reported` carry through as the same bytes the CLI prints. `structuredContent` is that same document again, marshalled by the same package. The tool description carries the value rules, because the calling model reads that text before it decides what a null means. It is a reader: stdio only, so it binds no port, calls no network and writes nothing at all. `internal/mcpserver` speaks hand-written JSON-RPC over `encoding/json`, which keeps the module's no-new-dependency position. Verified live against the built binary on Windows 11 with a scripted stdio client: seven messages in, six responses out, exit 0, empty stderr, and the tool's document validated against `docs/snapshot.schema.json`. `~/.telltale` was byte-identical before and after. CI drives the same sequence on every run and validates both spellings of the document. No third-party MCP client has connected to this server yet. STATE.md and design.md §7.25 carry that debt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
telltale mcpputs the snapshot document (design.md §7.22) in front of a readerthat is an agent. An MCP client starts the process, speaks JSON-RPC over stdio,
and calls one tool —
fleet_snapshot— which takes an optionalvendorargument, runs one scan and returns the document. One flag:
--timeout, and itis the deadline for each CALL rather than for the process.
The document is not re-made here
The tool result is
snapshot.Encodeover the documentsnapshot.Buildproducedfrom the scan
telltale snapshotruns. One scan path, one adapter roster, onevendor vocabulary, one serializer. So zero-vs-absent, the explicit nulls,
estimated,unsupportedandself_reportedarrive as the same bytes the CLIprints.
structuredContentis that document again, marshalled by the samepackage, so the two spellings cannot disagree.
The tool DESCRIPTION carries the value rules, because the calling model reads
that text and nothing else before it decides what a null means. A caller that
does not know them reads an absent reading as a zero, which is the collapse this
repo exists to prevent, moved one process outward into the agent.
It is a reader
Stdio only: the client owns both pipes, so this mode binds no port, calls no
network and writes nothing at all — not even the quota relay, because it renders
no quota of its own to relay. §7.24's question of who may reach a listener does
not arise, because there is no listener. Two tests hold that: an import gate,
and a whole session driven with the home directory redirected and the tree
compared before and after.
internal/mcpserveris hand-written JSON-RPC overencoding/json. That keepsthe module's standing position — no direct dependency outside the TUI stack,
recorded four times in design.md — and four methods with one tool is a smaller
surface than the SDK's own API.
Verified live
Windows 11, against the built binary, driven by a scripted stdio client. Seven
messages in, six responses out (the seventh was the notification, answered by
silence), exit 0, empty stderr.
docs/snapshot.schema.jsonwithtools/validate-snapshot.py:ok.agy's3p-weeklywindow carriedused_pctas0whilecost_usd_totalwasnullfleet-wide and five vendors carried
quota_read_at: null.~/.telltaleheld the identical 35 files, sizes and modification times beforeand after the session.
CI drives the same sequence against the built binary on every run and validates
BOTH spellings of the document. That gate was proved non-vacuous: one sentence
was removed from the tool description, the binary rebuilt, and the gate failed
naming the missing word.
What is not verified
No third-party MCP client has connected to this server. The drive proves a
correct server; it says nothing about how a shipped client negotiates a version
or renders a result. Wiring one up writes an entry into the operator's own
client configuration, which is his to make. STATE.md and design.md §7.25 carry
the debt.
🤖 Generated with Claude Code