You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2fc1932
Browse filesBrowse the repository at this point in the historyBrowse files
*`directory_read=True` also serves `resources/directory/read` (more on that
151
+
[below](#directory-reads-from-a-catalog)).
139
152
140
-
A skill is a directory that contains a `SKILL.md` file. The skill's files are all files beneath
141
-
that directory, including the files of any skill nested inside it. A nested skill is also listed
142
-
as a skill in its own right.
153
+
`SkillCatalog.load()` is a coroutine, so build the server inside a running event loop, as
154
+
`main()` does above.
143
155
144
-
Each file is served as a `skill://` resource. Its URI is `skill://` followed by its path, with
145
-
each path segment percent-encoded. A file has the same URI regardless of which skill lists it.
156
+
### How skills are found
146
157
147
-
Files and directories whose names begin with `.` are excluded. They are never read, listed, or
148
-
served. Files outside any skill directory are not served.
158
+
A skill is a directory that contains a `SKILL.md`. Its files are everything beneath that
159
+
directory, including the files of any skill nested inside it, which is also listed as a skill in
160
+
its own right.
149
161
150
-
The catalog reads and hashes every file once, when `load()` runs, and serves that snapshot. The
151
-
`resources` manifest of each skill therefore describes the files exactly as they were read.
152
-
The catalog is fixed for the lifetime of the server; to publish changes, create a new catalog.
162
+
Each file's URI is `skill://` followed by its path, with every segment percent-encoded. Files and
163
+
directories whose names start with `.` are ignored entirely, and files outside any skill directory
164
+
are not served.
153
165
154
-
### Options
166
+
!!! note
167
+
The catalog reads and hashes every file **once**, when `load()` runs, and serves that snapshot.
168
+
That's how the `digest` and `size` in each skill's manifest are guaranteed to match what
169
+
`resources/read` returns.
155
170
156
-
`SkillCatalog.load(provider, *, parse_frontmatter, ...)` accepts the following arguments.
171
+
It also means the catalog is fixed for the lifetime of the server. If a file changes
172
+
afterwards, reading it fails with an internal error (`-32603`) until you restart the server or
173
+
create a new catalog. And because `load()` reads every file, a large asset directory makes
174
+
startup slower.
157
175
158
-
| Argument | Default | Description |
159
-
|---|---|---|
160
-
|`provider`| required | The `SkillProvider` that lists and reads the files. |
161
-
|`parse_frontmatter`| required | Receives the text between the `---` lines of a `SKILL.md` and returns a mapping with `str` keys, for example `yaml.safe_load`. |
162
-
|`strict`|`False`| Controls the handling of invalid skills. See [Invalid skills](#invalid-skills). |
163
-
|`directory_read`|`False`| Serves `resources/directory/read` and advertises the `directoryRead` setting. |
164
-
|`ttl_ms`|`0`| The `ttlMs` value set on `skills/list`, `skills/get` and directory read results. |
165
-
|`cache_scope`|`"private"`| The `cacheScope` value set on the same results. |
166
-
|`page_size`|`None`| The maximum number of entries in one `skills/list` or directory read response. See [Pagination](#pagination). |
176
+
### Directory reads from a catalog
167
177
168
-
`ttl_ms` and `cache_scope` follow the rules described in
169
-
[Protocol version and caching](#protocol-version-and-caching). A negative `ttl_ms` raises
170
-
`ValueError`.
178
+
Pass `directory_read=True` and every directory that contains a served file can be read, including
179
+
directories above a skill such as `skill://acme`. A directory lists its direct children;
180
+
subdirectories come back with the MIME type `inode/directory`. Empty directories are not served.
171
181
172
-
The frontmatter mapping is returned in `skills/list` and `skills/get` without modification,
173
-
including keys the SDK does not interpret. Values are converted to JSON; for example, YAML dates
174
-
are returned as ISO 8601 strings. A value with no JSON representation, such as NaN, makes the
175
-
skill invalid.
182
+
### Caching hints
176
183
177
-
With `directory_read=True`, every directory that contains a served file can be read, including
178
-
directories above the skill root such as `skill://acme`. A directory lists its direct children;
179
-
subdirectories are returned with the MIME type `inode/directory`. Empty directories are not served.
184
+
`ttl_ms` and `cache_scope` set the `ttlMs` and `cacheScope` values on every result:
0 commit comments