~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

pds xrpc makes any call; MCP tools' titles and hints say what they do

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:cli/xrpc-and-tool-hints

pds xrpc makes any call by name, with goat's arguments. Every MCP tool now has a title, and its read-only and destructive hints come from what the method does, so getServiceAuth, which signs a token, is no longer marked read-only.

Claude Opus 5.5 · high

What changes

The spec. In spec/COMMANDS.md:

  • "Any call" (new section) defines pds xrpc <query|procedure> <name> [args]. It takes goat xrpc's HTTPie-style arguments (k==v, k=v, k:=json, Name:value, -, @path), calls PDS_URL with the CLI's usual auth, fills nothing in, and checks nothing against a lexicon. Its usage errors exit 2, and its answers are the same as other commands'.
  • "Names" gives each tool a title: the method's name in words, then its group, as Create record (repo). It also reserves the group xrpc.
  • "Hints" (new section) sets readOnlyHint and destructiveHint by what each method does:
    • The two queries that sign a token (getServiceAuth and space.getDelegationToken) are not read-only.
    • A procedure that only adds is not destructive, and the section lists those by name. Every other procedure is destructive, so one added later is treated as destructive until someone puts it on the list.
    • Before this, only deleteRecord, putRecord and applyWrites were marked destructive, and every query was marked read-only.

docs/guide/calling.md shows both changes.

The harness. With --commands, some requests now go through pds xrpc, sending their arguments in each form the request allows. tools/list is held to every tool's title and hints, in all three MCP versions. pds xrpc on the server's own routes and on a forwarded method must answer as XRPC does, and each usage error must exit 2 without a request reaching the server.

The server. The xrpc command is in pds-cli. Titles and hints come from pds-lexicon and are listed by NSID.

Why

We compared the designs that large schema-described APIs use for their CLIs and MCP servers:

  • CLIs. Every CLI surveyed (gh, goat, stripe, az, kubectl, oci) keeps its typed commands and adds a generic call next to them. We keep the generated commands and add the generic call.
  • MCP. A single generic tool would let one approval cover every procedure. Claude's connector review rejects a catch-all tool that mixes safe and unsafe calls. The one head-to-head eval found ranked describe-then-invoke last. So MCP keeps one tool per method; this pull fixes their titles and hints instead.
  • The bug. Clients may run a tool marked read-only without asking, and getServiceAuth, a query, was marked read-only.

How it was checked

Run here: --commands --steps 400 --seed 31 passed. 18 of its requests went through pds xrpc, along with the routes, forwarding, bodies and usage-error checks.

Two planted bugs, each caught at step 0 of a --commands run and then removed:

  • getServiceAuth taken off the list of token-signing queries made tools/list fail, because readOnlyHint was true.
  • - allowed on a query made the usage-error check fail, because the command exited 0 and sent a request.

just quick passed here. The gates are the gates workflow's, on this pull.

The spaces pages (SPACES-CREDENTIALS.md, SPACES-SYNC.md) said their tools were not destructive. They now defer to "Hints", so notifyCredentialRevoked and unregisterNotify are destructive.

Shortcomings

  • pds xrpc checks nothing before sending, as goat's command doesn't, so a bad argument costs one round trip.
  • openWorldHint and idempotentHint are still not set.

Review

Start with "Hints" in spec/COMMANDS.md; the list of additive procedures is a judgment call.

Approved

This adds pds xrpc, gives every MCP tool a title, and sets readOnlyHint and destructiveHint by what each method does. getServiceAuth and getDelegationToken are no longer read-only. I read all 17 files. Spec, code, harness and guides agree. The additive list in pds-lexicon matches the one in spec/COMMANDS.md, and the harness reads its expectations from the spec section, so the two can't drift apart unnoticed. The pds xrpc parser follows the spec. I did not run anything. The checks are the ones you named.

Two things are worth fixing, neither blocking:

  • activateAccount. The spec lists it as only adding, but the same section calls any procedure that changes an account's "status" destructive. It contradicts itself; I'd move it to destructive. confirmEmail is arguable for the same reason.
  • Harness string bodies. A body string that starts with = becomes a == query parameter, so the harness would send the wrong request and report a false diff.

The spec also calls a header name or value HTTP can't carry a usage error. Only the Rust unit test covers that, and the harness's usage-error list doesn't. Adding one case there would make the check match the spec.

harness/lib/via.mjsline 521
}
for (const [k, v] of entries) {
if (inFile.some(([f]) => f === k)) continue
props.push(typeof v === 'string' && !v.includes('\0') && chance(0.7) ? `${k}=${v}` : `${k}:=${JSON.stringify(v)}`)
review.knotless.dev

${k}=${v} with a v that starts with = gives k==…, which pds xrpc reads as a query parameter, not a string property. Send such a value as k:=json (or in the file) so the check can't report a false diff.

spec/COMMANDS.mdline 199
it only adds: `com.atproto.server.createAccount`, `createSession`,
`createAppPassword`, `createInviteCode`, `createInviteCodes`,
`requestEmailConfirmation`, `confirmEmail`, `requestEmailUpdate`,
`requestPasswordReset`, `requestAccountDelete`, `activateAccount`;
review.knotless.dev

activateAccount is listed as only adding, but the next lines make any procedure that changes an account's status destructive. Pick one; moving it to destructive fits that rule. The same goes for ADDITIVE in pds-lexicon.

Approved

The only change since my approval at 1e50243 is a rewording in spec/STORE.md, in the "first request to a cold account" bullet. It used to promise the 1-second bound however many accounts' first requests came at once. It now keeps that bound for one account's first request and the 6 MiB read bound. For many accounts at once it says only that they share the server's processors and take what that work costs. This doesn't touch the pds xrpc, titles or hints work I approved. I did not check whether the wording came in with a merge of the base. If it is the pull's own, it belongs in a separate change. My earlier notes on activateAccount and harness string bodies still stand. Neither was blocking, and I'm not asking for them again.

Merged as f0abe0a