Skip to content

Commit f1d2920

Browse files
author
vijay
committed
Correct Skills docs on read_skill_uri return type and verify on dynamic skills
`read_skill_uri` returns a `ReadResourceResult`, not bytes, and `verify_skill_resource` raises for a `"dynamic"` skill (no digests to check). Import the tutorials' symbols from `mcp.types` rather than the internal `mcp_types` package.
1 parent 38706c1 commit f1d2920

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

docs/advanced/skills.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ skills or resources in one call; `get_skill` costs exactly one request. These th
5050
server's response against the SEP-2640 conformance rules before returning it — a name that doesn't
5151
match its URI, a digest in the wrong shape, or an incomplete manifest raises `ValueError` rather
5252
than reaching your code. `read_skill_uri` is the exception: a thin, discoverable alias for
53-
`resources/read` that returns bytes and validates nothing itself (see the next paragraph).
53+
`resources/read` that returns a `ReadResourceResult` (text or blob contents) and validates nothing
54+
itself (see the next paragraph).
5455

5556
`verify_skill_resource(skill, uri, content)` checks a file's bytes — size, then SHA-256 digest —
5657
against the entry you hold for it. Call it after `read_skill_uri` and before treating the content
5758
as trustworthy: `resources/read` returns whatever bytes the server sends *right now*, verification
58-
is what ties those bytes back to the manifest you already validated.
59+
is what ties those bytes back to the manifest you already validated. It applies to a static
60+
manifest only — a `"dynamic"` skill carries no digests, so calling it on one raises `ValueError`.
5961

6062
!!! warning
6163
Skill content is untrusted model input, exactly like any other server-provided text. SEP-2640

docs_src/skills/tutorial001.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import hashlib
22
from typing import Any
33

4-
from mcp_types import INVALID_PARAMS
5-
64
from mcp.server.context import ServerRequestContext
75
from mcp.server.mcpserver import MCPServer
86
from mcp.server.mcpserver.resources import TextResource
@@ -16,6 +14,7 @@
1614
Skill,
1715
SkillResource,
1816
)
17+
from mcp.types import INVALID_PARAMS
1918

2019
SKILL_URI = "skill://git-workflow/SKILL.md"
2120
SKILL_MD = """\

docs_src/skills/tutorial001_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import anyio
2-
from mcp_types import TextResourceContents
32

43
from mcp import Client
54
from mcp.client.skills import get_skill, list_skills, read_skill_uri, verify_skill_resource
5+
from mcp.types import TextResourceContents
66

77

88
async def main() -> None:

0 commit comments

Comments
 (0)