ドキュメント › Slima MCP › スキーマのリソースを問い合わせる

スキーマのリソースを問い合わせる

最終更新 September 9, 2026 · 約8分で読めます

MCPにはツールだけでなくリソースもあります。スキーマのリソースはその代表で、作品ごとの権限をAIに教えます。

Slimaの「連携アプリ」ページ。スキーマのリソースを読んで権限を確かめるMCPクライアントもここに並ぶ(画面は英語表示)

使い方

Resource URI: slima://books/{book_token}/schema

MCPに対応したクライアントはリソースを直接読めます。ツールを呼ぶ必要はありません。

# 疑似コード(実際の書き方はクライアントのリソースAPIによります)
schema = read_resource("slima://books/bk_xxx/schema")

返ってくるもの

{
  "book_token": "bk_xxx",
  "book_type": "script",
  "studio_label": "Script Studio",
  "mcp_capabilities": {
    "readable_paths": "Any path within the book tree ...",
    "writable_paths": [".script_studio/planning/**/*"],
    "writable_exceptions": [".script_studio/planning/.initialized"],
    "readonly_paths": [
      ".script_studio/series.json",
      ".script_studio/seasons/**/season.json",
      ".script_studio/seasons/**/episodes/**/episode.json",
      ".script_studio/seasons/**/scenes/*.scene",
      ".script_studio/characters/**/*.character",
      ".script_studio/locations/**/*.location",
      ".script_studio/storylines/**/*.storyline",
      ".script_studio/notes/**/*.note",
      ".script_studio/planning/.initialized"
    ],
    "write_access_note": "..."
  },
  "ai_file_policy": {
    "writable": [".md", ".markdown", ".txt"],
    "field_level_tools": {
      ".beats": "update_beat_board",
      ".timeline": "update_timeline",
      ".script": "update_script",
      ".map": "update_relationship_map",
      ".geomap": "update_world_map"
    },
    "readonly": [".character", ".location", ".json", ".yaml", ".yml"],
    "authority": "get_capabilities"
  },
  "structured_file_types": { "*.scene": "...", "*.character": "..." },
  "policy_source": "Rails: Mcp::FileOperationService#validate_studio_write_path!"
}

このリソースがある理由

*.sceneに書き込もうとすれば400で失敗します。ただ、先にスキーマを読んでおけば、そのパスが読み取り専用だとあらかじめわかります。無駄なAPI呼び出しが減ります。

おすすめの手順

1. list_books で book_token を得る
2. read_resource(slima://books/{token}/schema) で決まりを得る
3. その決まりに沿って読み書きの段取りを立てる
4. 実行する

MCPに対応したクライアントには、リソースを自動でAIに渡すものがあります。AIが明示的に呼ぶ必要はありません。

ライティングスタジオの作品のスキーマ

{
  "book_token": "bk_xxx",
  "book_type": "book",
  "studio_label": "Writing Studio",
  "mcp_capabilities": {
    "writable_paths": ["**/*"],
    "readonly_paths": []
  },
  "ai_file_policy": {
    "writable": [".md", ".markdown", ".txt"],
    "field_level_tools": {
      ".beats": "update_beat_board",
      ".timeline": "update_timeline",
      ".script": "update_script",
      ".map": "update_relationship_map",
      ".geomap": "update_world_map"
    },
    "readonly": [".character", ".location", ".json", ".yaml", ".yml"],
    "authority": "get_capabilities"
  },
  "structured_file_types": {}
}

パスとファイル型は別々の問いです。ひとつに読まないでください。

mcp_capabilitiesはパスの答えです。ライティングスタジオの作品では、どのパスにも書けます。

ai_file_policyは型の答えで、こちらは両方のスタジオに効きます。汎用の書き込み系(write_file、edit_file、append_to_file、delete_file)が扱うのは原稿だけ——.md、.markdown、.txtです。field_level_toolsにある五つの型は、そこに書かれた道具で一項目ずつ直します。ファイル全体の書き込みは断られます。モデルに見せられていない部分が落ちるからです。これらへの書き込みには有料プランが必要で、読むだけなら不要です。readonlyにある型はいっさい書けません。

覚えておく価値のある例外がcreate_fileです。構造化ファイルに対しては、形の正しい空のファイルを作り、送った内容は無視します。先に作ってから、道具で埋めていく流れになります。

このブロックはclientと一緒に配布されるため、サーバーの配備より遅れることがあります。食い違ったときはget_capabilitiesが正しい——authorityの欄はそれを言っています。

関連

Slimaで試してみる

アプリを開いて、自分の作品で同じ手順をたどってみてください。無料で始められます。クレジットカードは不要です。

Slimaを開く
この記事は役に立ちましたか?