extensions
Skills
Bases: ClientExtension
The client-side Skills extension: register, then access its typed verbs.
Pass an instance to Client(extensions=[Skills()]) — this advertises
io.modelcontextprotocol/skills under the client's capabilities — and call
client.extension(Skills) once connected for a SkillsClient handle.
Source code in src/mcp/client/extensions/skills.py
42 43 44 45 46 47 48 49 50 51 52 53 54 | |
bind
bind(session: ClientSession) -> SkillsClient
Return the SEP-2640 verbs bound to session.
Source code in src/mcp/client/extensions/skills.py
52 53 54 | |
SkillsClient
The SEP-2640 verbs bound to one connected session.
Obtain it from client.extension(Skills). The catalog verbs — list_skills,
get_skill, and read_directory — check that the server advertises the
extension and validate its response against the SEP-2640 conformance rules
before returning; list_skills and read_directory also follow
nextCursor to completion. Read a skill's files with the ordinary
Client.read_resource method.
Source code in src/mcp/client/extensions/skills.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
list_skills
async
list_skills(
params: ListSkillsParams | None = None,
) -> list[Skill]
Call skills/list, following nextCursor to completion, and validate the result.
A skill a changing catalog surfaces on more than one page is returned once, in the order first seen.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the server doesn't advertise the Skills extension, its response is not SEP-2640 conformant, or it repeats a pagination cursor. |
MCPError
|
If the server returns an error response. |
Source code in src/mcp/client/extensions/skills.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
get_skill
async
Call skills/get for uri and validate the result.
Unlike list_skills, this succeeds for a skill absent from any listing —
per SEP-2640, a server MUST answer skills/get for every skill it serves.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the server doesn't advertise the Skills extension, its response names a different skill, or the skill is not conformant. |
MCPError
|
If the server returns an error response, such as |
Source code in src/mcp/client/extensions/skills.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
read_directory
async
read_directory(
uri: str, params: ReadDirectoryParams | None = None
) -> list[Resource]
Call resources/directory/read for uri, following nextCursor to completion.
A child a changing directory surfaces on more than one page is returned once, in the order first seen.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the server doesn't advertise the |
MCPError
|
If the server returns an error response. |
Source code in src/mcp/client/extensions/skills.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |