Module: Textus::MCP::ToolSchemas

Defined in:
lib/textus/mcp/tool_schemas.rb

Overview

JSON-Schema definitions for every MCP tool’s inputSchema. Returned by the server in tools/list. Static today — a follow-up will enrich with manifest-derived enums for ‘zone`, `key`, etc.

Class Method Summary collapse

Class Method Details

.allObject

rubocop:disable Metrics/MethodLength



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/textus/mcp/tool_schemas.rb', line 9

def all # rubocop:disable Metrics/MethodLength
  [
    tool("boot", "Return the orientation contract: zones, entries, schemas, write_flows, agent_quickstart.", {}, []),
    tool("tick", "Delta since cursor. Returns {cursor, changed, stale, pending_review, doctor}.",
         { "since" => { "type" => "integer", "minimum" => 0 } }, []),
    tool("find", "List keys filtered by zone and/or prefix.",
         { "zone" => { "type" => "string" }, "prefix" => { "type" => "string" } }, []),
    tool("read", "Read one entry. Returns the envelope (uid, etag, _meta, body, freshness).",
         { "key" => { "type" => "string" } }, ["key"]),
    tool("write", "Create or update an entry. Schema-validated. Returns {uid, etag}.",
         {
           "key" => { "type" => "string" },
           "meta" => { "type" => "object" },
           "body" => { "type" => "string" },
           "content" => { "type" => "object" },
           "if_etag" => { "type" => "string" },
         }, %w[key meta]),
    tool("propose", "Write a proposal to the session's propose_zone. Auto-prefixes the key.",
         {
           "key" => { "type" => "string", "description" => "Key relative to propose_zone, e.g. 'proposal.feature-x'" },
           "meta" => { "type" => "object" },
           "body" => { "type" => "string" },
         }, %w[key meta]),
    tool("refresh", "Run an intake refresh for one key. Returns the refresh Outcome.",
         { "key" => { "type" => "string" } }, ["key"]),
    tool("refresh_stale", "Refresh all stale intake entries, optionally scoped by zone/prefix.",
         {
           "zone" => { "type" => "string" },
           "prefix" => { "type" => "string" },
         }, []),
    tool("schema", "Return the schema (field shape) for an entry family.",
         { "family" => { "type" => "string" } }, ["family"]),
    tool("rules", "Return effective rules for a key (refresh, promote, ...).",
         { "key" => { "type" => "string" } }, ["key"]),
    tool("key_mv_prefix",
         "Bulk-rename every leaf key under from_prefix to to_prefix. Dry-run returns a Plan; apply with dry_run: false.",
         { "from_prefix" => { "type" => "string" }, "to_prefix" => { "type" => "string" }, "dry_run" => { "type" => "boolean" } },
         %w[from_prefix to_prefix]),
    tool("key_delete_prefix", "Bulk-delete every leaf key under prefix.",
         { "prefix" => { "type" => "string" }, "dry_run" => { "type" => "boolean" } },
         ["prefix"]),
    tool("zone_mv", "Rename a zone — manifest + files. Refuses if destination exists.",
         { "from" => { "type" => "string" }, "to" => { "type" => "string" }, "dry_run" => { "type" => "boolean" } },
         %w[from to]),
    tool("rule_lint", "Diff candidate manifest YAML's rules against the live manifest. No writes.",
         { "candidate_yaml" => { "type" => "string" } },
         ["candidate_yaml"]),
    tool("migrate", "Run a YAML migration plan (multi-op).",
         { "plan_yaml" => { "type" => "string" }, "dry_run" => { "type" => "boolean" } },
         ["plan_yaml"]),
  ].freeze
end

.tool(name, description, properties, required) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/textus/mcp/tool_schemas.rb', line 62

def tool(name, description, properties, required)
  {
    name: name,
    description: description,
    inputSchema: { type: "object", properties: properties, required: required },
  }
end