Skip to content

agent: a skills directory is read from the server when it declares directoryRead - #765

Merged
jaredLunde merged 2 commits into
mainfrom
mcp-skills-directory-read
Nov 30, 2026
Merged

jaredLunde merged 2 commits into
mainfrom
mcp-skills-directory-read

Conversation

@jaredLunde

Copy link
Copy Markdown
Contributor

What

The Skills extension defines one capability setting, directoryRead, and the method behind it,
resources/directory/read (ext-skills specification/beta/skills.mdx, "Reading Directories"). We
implemented skills/list, skills/get, digest/size/frontmatter verification, permissions and
everything else in that spec — but we never sent resources/directory/read: 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. Upstream's implementations list marks hosts in exactly that
position partial.

This adds the method, gated the way the spec words it:

  • Only against a declaring server. directoryRead: true in
    capabilities.extensions["io.modelcontextprotocol/skills"] is the promise the method rests on, and
    the spec forbids calling it otherwise. A server without the setting is answered from the manifest,
    exactly as before.
  • Paged and bounded. nextCursor is followed (at most 32 pages / 2000 children), and
    subdirectories are recognized by mimeType: "inode/directory".
  • The live view never extends the manifest — that is the spec's MUST. A child no manifest lists is
    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 server
    no longer reports is named as no longer served.
  • Failures degrade honestly. -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, the
directoryRead gate 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 run against 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:

$ agent run "list the git-workflow references"   # fixture with directoryRead: true

Directory skill://git-workflow/references of skill `git-workflow` (MCP server `docs`) — the server's
live listing, which may be ahead of or behind your loaded snapshot:
GUIDE.md

# fixture wire log
server/discover
tools/list
resources/list
prompts/list
skills/list
skills/get skill://git-workflow/SKILL.md
resources/read skill://git-workflow/SKILL.md
resources/directory/read skill://git-workflow/references

Drift both ways — MCP_SKILLS_FIXTURE_DIR_DRIFT=1 (the server drops GUIDE.md from its listing and
serves an unlisted LIVE-ONLY.md):

Directory skill://git-workflow/references of skill `git-workflow` (MCP server `docs`) — the server's
live listing, which may be ahead of or behind your loaded snapshot:

Listed by the server but not in your loaded snapshot (the skill has changed; load
`skill://git-workflow/SKILL.md` again to refresh and re-approve it — these are not readable under the
snapshot you hold):
LIVE-ONLY.md

In your snapshot but no longer served (a read would fail; load `skill://git-workflow/SKILL.md` again
to refresh):
GUIDE.md

Before/after on the wire — same prompt, same fixture, the extension declared without the setting
(MCP_SKILLS_FIXTURE_NO_DIRECTORY_READ=1):

Directory skill://git-workflow/references of skill `git-workflow` (MCP server `docs`):
GUIDE.md

# wire log ends at resources/read; directory reads sent: 0

Tests (cargo test -p beyond-agent --test it mcp_skills_directory, on the repo's pinned 1.92):

test mcp_skills_directory::a_declaring_server_answers_the_directory_from_its_live_view ... ok
test mcp_skills_directory::a_server_without_the_setting_is_answered_from_the_manifest_and_never_asked ... ok
test mcp_skills_directory::a_live_child_no_manifest_lists_is_named_changed_and_never_read ... ok
test mcp_skills_directory::every_page_of_a_paged_live_listing_reaches_the_model ... ok

test result: ok. 4 passed; 0 failed

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/read when the setting is absent; zero
resources/read of a live-only child (the model is told to reload instead); four page requests for a
four-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 mcp sweep → 370 passed, 6 failed, where those six (agent_tools_mcp::* "ends_turn" /
"saved menu" / "connector" cases) fail identically on clean main in this environment because
sdk/ts/node_modules is not installed — unrelated to this change.

cargo clippy -p beyond-agent --all-targets --locked: clean. cargo fmt --check: clean.

Open in Capy

jaredLunde and others added 2 commits November 30, 2026 09:26
…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>
@jaredLunde
jaredLunde added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit 5a243a8 Nov 30, 2026
27 checks passed
@jaredLunde
jaredLunde deleted the mcp-skills-directory-read branch November 30, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant