Repository navigation
Add cache fields to directory read and _meta to Skill
#3719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -179,6 +179,20 @@ async def mutating_list(ctx: ServerRequestContext[Any, Any], params: ListSkillsP | |
| assert exc_info.value.code == INTERNAL_ERROR | ||
|
|
||
|
|
||
| async def test_skills_list_sends_skill_meta_as_underscore_meta() -> None: | ||
| """ext-skills#157: a skill's optional metadata crosses the wire as `_meta`, not `meta`.""" | ||
|
|
||
| async def with_meta(ctx: ServerRequestContext[Any, Any], params: ListSkillsParams) -> ListSkillsResult: | ||
| skill = _git_workflow_skill().model_copy(update={"meta": {"example.com/owner": "platform"}}) | ||
| return ListSkillsResult(skills=[skill]) | ||
|
|
||
| server = MCPServer("catalog", extensions=[Skills(list_skills=with_meta, get_skill=_get_skill)]) | ||
| async with Client(server, mode="2026-07-28") as client: | ||
| raw = await client.session.send_request(ListSkillsRequest(), _RawResult) | ||
| extra = raw.model_extra or {} | ||
|
Comment on lines
+186
to
+192
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 nit (optional): maintainers get a Why this was flaggedAGENTS.md line 68 delegates test review to Verification: nit. AGENTS.md line 68 delegates tests to |
||
| assert extra["skills"][0]["_meta"] == {"example.com/owner": "platform"} | ||
|
|
||
|
|
||
| async def test_skills_get_returns_the_matching_skill() -> None: | ||
| async with Client(_server()) as client: | ||
| result = await client.session.send_request( | ||
|
|
@@ -321,6 +335,28 @@ async def test_directory_read_returns_the_handlers_children() -> None: | |
| assert [r.uri for r in result.resources] == ["skill://git-workflow/references"] | ||
|
|
||
|
|
||
| async def test_directory_read_defaults_to_private_cache_scope_on_the_2026_07_28_wire() -> None: | ||
| """ext-skills#157: `resources/directory/read` results carry SEP-2549's cache fields too.""" | ||
| async with Client(_server(with_directory_read=True), mode="2026-07-28") as client: | ||
| raw = await client.session.send_request( | ||
| ReadDirectoryRequest(params=ReadDirectoryParams(uri="skill://git-workflow")), _RawResult | ||
| ) | ||
| extra = raw.model_extra or {} | ||
| assert (extra["ttlMs"], extra["cacheScope"]) == (0, "private") | ||
|
|
||
|
|
||
| async def test_directory_read_omits_cache_fields_on_a_legacy_wire() -> None: | ||
| """SEP-2549 fields are 2026-07-28+ only, and the runner's sieve skips extension methods, | ||
| so `Skills` strips them itself for an older connection.""" | ||
| async with Client(_server(with_directory_read=True), mode="legacy") as client: | ||
| raw = await client.session.send_request( | ||
| ReadDirectoryRequest(params=ReadDirectoryParams(uri="skill://git-workflow")), _RawResult | ||
| ) | ||
| extra = raw.model_extra or {} | ||
| assert "cacheScope" not in extra | ||
| assert "ttlMs" not in extra | ||
|
|
||
|
|
||
| async def test_directory_read_is_not_registered_without_a_handler() -> None: | ||
| """SDK-defined: omitting `read_directory` doesn't just skip the capability ad - the | ||
| method itself isn't registered, so calling it anyway is Method not found.""" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.