skills: add filesystem provider helper - #1240
Draft
sambhav wants to merge 3 commits into
Draft
Conversation
This was referenced Sep 4, 2026
sambhav
force-pushed
the
skills-sep-2640-fs-helper
branch
from
September 4, 2026 22:48
bd1e1fa to
e6d64a1
Compare
9 tasks
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.
Summary
Add an optional filesystem provider for SEP-2640, covering discovery, metadata, manifests, resource reads, directory browsing, pagination, and refresh policy.
The latest revision adds:
resources/listenumeration alongside ordinary registered resources.These changes exercise both previously untestable metadata SHOULD checks in conformance #330.
Review status
This is PR 2 of 2, depends on #1238, and remains a draft.
The helper-only diff is available at sambhav/go-sdk#1. The upstream diff includes the generic protocol layer until #1238 merges; this branch can then be rebased onto
mainand marked ready.Usage
Use
skills.AddFS(server, fsys, options)forembed.FS,fstest.MapFS, or anotherfs.FS. Mutable filesystem implementations synchronize themselves.By default, requests discover additions, changes, and removals:
skills/listandskills/getreturn complete manifests, including nested skills.resources/listincludes skill files alongside ordinary registered resources.resources/readreads file bytes on demand through resource-template dispatch.resources/directory/readreturns paginated direct children, including empty subdirectories markedinode/directory.text/markdownfor SKILL.md.A changing catalog can still return complete static manifests.
DynamicResources()means a complete manifest with stable digests is unavailable.Refresh and caching
Cache: nil(default)Cache: &DirectoryCacheOptions{}Cache.Preload: trueCache.MaxAgeorCache.Invalidateprovider.Refresh(ctx)For explicit refresh, construct a provider with
NewDirectoryProviderorNewFSProvider, then callprovider.AddTo(server).Successful rebuilds replace the cached catalog atomically. Failed rebuilds retain the previous catalog but leave it stale: subsequent requests retry and return scan errors until rebuilding succeeds.
Resource bytes remain on demand even with cached metadata, so clients still need manifest verification after edits.
Resource and directory enumeration walk metadata and parse skill frontmatter without hashing supporting files. Skills enumeration and cache rebuilds hash complete manifests; each physical supporting file is hashed once per rebuild, including across nested skills.
The application owns filesystem watchers, timers, cancellation, and shutdown. Clients re-list to observe changes; this helper starts no watcher and emits no filesystem-change notifications. SEP-2640 defines no
skills/list_changednotification.Resource composition
The helper uses existing receiving middleware and resource-template routing, adding no further core MCP APIs beyond #1238.
DirectoryProvider.ListResourcesis also available directly.For
resources/list, the middleware:DirectoryOptions.PageSize.The tradeoff is a full traversal of the underlying resource list per request. Combined lists use zero TTL and private cache scope so cached ordinary-resource listings cannot hide filesystem changes. Cache fields are omitted on older protocol versions.
Register one filesystem provider per server. Multiple roots can use an overlay filesystem or generic aggregation handlers.
Symlinks and non-regular files are rejected. SEP and Agent Skills validation, including the default 512-resource and 16 MiB limits, remains enabled with custom validators and explicit unsafe overrides.
Interoperability
TypeScript supports request-time resource-template list callbacks, and Python’s low-level SDK supports request-time resource-list handlers. Go already supports runtime registry changes and receiving middleware; this provider uses those existing extension points.
Inspector #2251 consumes
skills/listandskills/getdirectly, including the modern list envelope. Directory browsing is tracked separately in #2248, with detail-pane improvements in #2265.Conformance and validation
Validated on 2026-09-06 using conformance #330 at
fa8aaec3611e387249da6adc826b02dd77372a3e, against the combined protocol/helper stack ata33c199eead5817160581ac834fb0e11e7e0a390.The fixture includes multiple and nested skills, supporting directories, an ordinary registered resource, and page size 1.
Totals include each scenario’s
wire-schema-validcheck. Both previously untestable resource metadata SHOULD checks now pass.Older-version cache-field compatibility is already handled by #1238:
skills/listomitsttlMsandcacheScopebefore2026-07-28.The sole legacy warning is a conformance-harness false positive. Its cache-attributes check warns about missing fields without checking the effective protocol version. The harness should report this requirement as
SKIPPEDon older versions and enforce it on2026-07-28and later.All upstream workflows passed on the tested commit: Test, Docs Check, Conformance Tests, and CodeQL. Local skills race tests, vet, and build also passed.
For legacy conformance runs, use
--spec-version 2025-11-25 --force. The modern fixture usesStreamableHTTPOptions{Stateless: true}.