Repository navigation
agent: a skills directory is read from the server when it declares directoryRead - #765
Merged
Merged
Conversation
…rectoryRead
The Skills extension's one setting, capabilities.extensions["io.modelcontextprotocol/skills"].directoryRead,
promises resources/directory/read for every directory in the skill namespaces a server serves. The
client never sent it: a directory URI of a loaded skill was answered from the held manifest, and a
server that publishes files its manifest does not name had no way to show them.
A directory of a loaded skill is now the server's live listing when the server declared the setting
(paged, subdirectories by mimeType: inode/directory). The manifest still governs what may be read:
a child no manifest lists is named as the skill having changed and is refused by the loader without
a request, and a manifest file the server dropped is reported as no longer served. -32602 ("not a
directory I serve") falls back to the manifest path; any other failure keeps the manifest answer
with the error annotated. A server without the setting is never asked.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ed clause Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.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.
What
The Skills extension defines one capability setting,
directoryRead, and the method behind it,resources/directory/read(ext-skillsspecification/beta/skills.mdx, "Reading Directories"). Weimplemented
skills/list,skills/get, digest/size/frontmatter verification, permissions andeverything else in that spec — but we never sent
resources/directory/read: a directory URI of aloaded skill was answered from the held manifest, and a server that publishes files its manifest does
not name had no way to show them. Upstream's implementations list marks hosts in exactly that
position
partial.This adds the method, gated the way the spec words it:
directoryRead: trueincapabilities.extensions["io.modelcontextprotocol/skills"]is the promise the method rests on, andthe spec forbids calling it otherwise. A server without the setting is answered from the manifest,
exactly as before.
nextCursoris followed (at most 32 pages / 2000 children), andsubdirectories are recognized by
mimeType: "inode/directory".named as the skill having changed and stays unreadable under the held snapshot: the loader refuses
it without ever sending a
resources/read(asserted on the wire, below). A manifest file the serverno longer reports is named as no longer served.
-32602("not a directory I serve") falls back to the manifest path,which names the failure precisely; any other failure keeps the manifest answer with the error
annotated rather than failing the call.
Code:
tools/mcp_skills.rs(live_dir,render_live_dir, thedirectoryReadgate in the loading tool), the fixture server learned the method, and ARCHITECTURE.md's"MCP skills (SEP-2640)" section documents the rule. New suite:
tests/mcp_skills_directory.rs.End-to-end proof
Everything below is the real binary: the real
agent runagainst the real fixture server over stdio,with a scripted Anthropic gateway as the model, and what the model was actually handed read back out
of the recorded request body.
Ordinary case — the live listing is what the model gets, and the method went over the wire:
Drift both ways —
MCP_SKILLS_FIXTURE_DIR_DRIFT=1(the server dropsGUIDE.mdfrom its listing andserves an unlisted
LIVE-ONLY.md):Before/after on the wire — same prompt, same fixture, the extension declared without the setting
(
MCP_SKILLS_FIXTURE_NO_DIRECTORY_READ=1):Tests (
cargo test -p beyond-agent --test it mcp_skills_directory, on the repo's pinned 1.92):Each asserts against the fixture's wire log, not the client's opinion of itself: one live listing per
directory asked for; zero
resources/directory/readwhen the setting is absent; zeroresources/readof a live-only child (the model is told to reload instead); four page requests for afour-child directory paged one child at a time, all four children reaching the model.
No regressions:
cargo test -p beyond-agent --test it skills→ 80 passed, 0 failed, and the wider--test it mcpsweep → 370 passed, 6 failed, where those six (agent_tools_mcp::*"ends_turn" /"saved menu" / "connector" cases) fail identically on clean
mainin this environment becausesdk/ts/node_modulesis not installed — unrelated to this change.cargo clippy -p beyond-agent --all-targets --locked: clean.cargo fmt --check: clean.