用 schema resource 查精確權限
閱讀約 4 分鐘
MCP 不只有 tools——還有 resources。schema resource 是其中一個關鍵的:告訴 AI 一本書的精確權限。

怎麼用
資源 URI:slima://books/{book_token}/schema
支援 MCP 的 client 可以直接讀 resource,不用呼叫 tool。
# Pseudo-code(看你 client 怎麼提供 resource API)
schema = read_resource("slima://books/bk_xxx/schema")
回傳的內容
{
"book_token": "bk_xxx",
"book_type": "script",
"writable_paths": [".script_studio/planning/**/*"],
"readonly_paths": [
"*.scene",
"*.character",
"*.storyline",
"*.note",
"*.location",
"series.json",
"season.json",
"episode.json",
".script_studio/planning/.initialized"
],
"structured_extensions": [".scene", ".character", ".storyline", ".note", ".location"],
"search_excludes_structured_by_default": true
}
為什麼有這個 resource
AI 寫 *.scene 會被擋(400)—— 但先呼叫 schema 就能事前知道這條 path 寫不了、不浪費 API call。
AI 的推薦工作流程
1. list_books → 拿 book_token
2. read_resource(slima://books/{token}/schema) → 拿規則
3. 根據規則安全規劃 read / write 操作
4. 開始實際操作
支援 MCP 的 client(Claude / Cursor)會自動把 resource 攤平給 AI 看——AI 不需要明確呼叫。
Writing Studio 書的 schema
{
"book_token": "bk_xxx",
"book_type": "book",
"writable_paths": ["**/*"],
"readonly_paths": [],
"structured_extensions": [],
"search_excludes_structured_by_default": false
}
簡單——所有路徑都可寫、沒結構化。
相關
這篇有幫助嗎?