Explorer

definy.mcp-tools

description
The MCP tools of the definy server (docs/mcp.md)
type
List<@definy.mcp-tool>
expression
[
  {
    name: "definy_get_project",
    description: "Show the content of a project branch as text: every part as 'module.name: type', with its description. Types use the definy text syntax (Fn(a: Number) -> String, List<T>, Record{...}, Union{#a, #b(T)}, @module.part references). Use definy_get_part for a part's expression.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name, e.g. 'core'")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default: main)")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("project")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-get-project(arguments: $0, request: $1)
  },
  {
    name: "definy_get_part",
    description: "Show one part as text: its id, content hash, visibility, description, type and expression. The expression uses the definy text syntax: fn(x$0) => body, $0 for variables, @module.part(arg: value) for calls, match v { #tag(x$1) => ... }, let x$2 = v; body, #tag<@type>(payload) for variants. Searches the main branch of every project unless project is given.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "part",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The part as 'module.name', e.g. 'core.plus'")}
            ])
          },
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name (optional)")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Branch name when project is given (default: main)")
              }
            ])
          },
          {
            key: "snapshot",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The event hash of a snapshot to read the part as of that snapshot (definy_get_history lists them). project and branch are ignored")
              }
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("part")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-get-part(arguments: $0, request: $1)
  },
  {
    name: "definy_whoami",
    description: "Show the dedicated account this MCP server signs writes with (account id, name, and whether it exists on the server). Writing is disabled when the server has no account key.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {key: "properties", value: #object<@definy.json>([])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-whoami(arguments: $0, request: $1)
  },
  {
    name: "definy_create_branch",
    description: "Create a new branch of an existing project, owned by this server's dedicated account. The first snapshot copies the latest snapshot of the source branch (the same as the web UI). Only the creator of a branch can take snapshots on it.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The new branch name")}
            ])
          },
          {
            key: "fromBranch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The branch to copy (default: main)")}
            ])
          },
          {
            key: "message",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Snapshot message (default: 'Create branch <branch>')")
              }
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([#string<@definy.json>("project"), #string<@definy.json>("branch")])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-create-branch(arguments: $0, request: $1)
  },
  {
    name: "definy_create_project",
    description: "Create a new project whose main branch is owned by this server's account. The first snapshot of main has no modules; add modules and parts with definy_create_snapshot (branch: main). Module names must not be used by another project.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The new project name")}
            ])
          },
          {
            key: "description",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("English description of the project (optional)")}
            ])
          },
          {
            key: "message",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Snapshot message (default: 'Create project <project>')")
              }
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("project")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-create-project(arguments: $0, request: $1)
  },
  {
    name: "definy_create_snapshot",
    description: "Take a snapshot of changes of parts on a branch owned by this server's account (definy_create_branch makes one; only the creator of a branch can take snapshots on it). Each change names a part as 'module.name' and gives its new type and/or expression in the definy text syntax (the same syntax definy_get_part shows), new descriptions (description is English; descriptions is an object from a language code to the text, '' removes that language), a visibility ('public' or 'private'), or delete: true. Omitted fields keep the current values, and an empty string removes the type or the expression. A part or module that does not exist yet is added. modules changes modules after the part changes: new descriptions (description is English, descriptions by language code; '' removes that language), visibility ('public' or 'private'), a new name (rename; references from other parts are not rewritten) or delete: true (removes the module and all its parts). project_description sets the English description of the project, and project_descriptions the descriptions by language code. The server type-checks the whole snapshot and rejects it with the errors. With check: true, the snapshot is only type-checked and not taken (to see the errors before taking it).",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (owned by this server's account)")}
            ])
          },
          {
            key: "message",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Snapshot message (default: 'Change parts')")}
            ])
          },
          {
            key: "changes",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("array")},
              {key: "description", value: #string<@definy.json>("The part changes, applied in order")},
              {
                key: "items",
                value: #object<@definy.json>([
                  {key: "type", value: #string<@definy.json>("object")},
                  {
                    key: "properties",
                    value: #object<@definy.json>([
                      {
                        key: "part",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("The part as 'module.name'")}
                        ])
                      },
                      {
                        key: "type",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {
                            key: "description",
                            value: #string<@definy.json>("The new type in the definy text syntax, e.g. 'Fn(value: Number) -> String' ('' removes it)")
                          }
                        ])
                      },
                      {
                        key: "expression",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {
                            key: "description",
                            value: #string<@definy.json>("The new expression in the definy text syntax, e.g. 'fn(value$0) => @core.plus(left: $0, right: 1)' ('' removes it)")
                          }
                        ])
                      },
                      {
                        key: "description",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("The new English description")}
                        ])
                      },
                      {
                        key: "descriptions",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("object")},
                          {
                            key: "description",
                            value: #string<@definy.json>("New descriptions by language code, e.g. {\"ja\": \"...\", \"eo\": \"...\"} ('' removes that language; other languages are kept)")
                          }
                        ])
                      },
                      {
                        key: "visibility",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {
                            key: "description",
                            value: #string<@definy.json>("'public' or 'private' (a private part can be referenced only from its module)")
                          }
                        ])
                      },
                      {
                        key: "delete",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("boolean")},
                          {key: "description", value: #string<@definy.json>("Delete the part")}
                        ])
                      }
                    ])
                  },
                  {key: "required", value: #array<@definy.json>([#string<@definy.json>("part")])}
                ])
              }
            ])
          },
          {
            key: "modules",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("array")},
              {
                key: "description",
                value: #string<@definy.json>("Module changes, applied in order after the part changes")
              },
              {
                key: "items",
                value: #object<@definy.json>([
                  {key: "type", value: #string<@definy.json>("object")},
                  {
                    key: "properties",
                    value: #object<@definy.json>([
                      {
                        key: "module",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("The module name")}
                        ])
                      },
                      {
                        key: "description",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("The new English description ('' removes it)")}
                        ])
                      },
                      {
                        key: "descriptions",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("object")},
                          {
                            key: "description",
                            value: #string<@definy.json>("New descriptions by language code, e.g. {\"ja\": \"...\"} ('' removes that language; other languages are kept)")
                          }
                        ])
                      },
                      {
                        key: "visibility",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("'public' or 'private'")}
                        ])
                      },
                      {
                        key: "rename",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("string")},
                          {key: "description", value: #string<@definy.json>("The new module name")}
                        ])
                      },
                      {
                        key: "delete",
                        value: #object<@definy.json>([
                          {key: "type", value: #string<@definy.json>("boolean")},
                          {key: "description", value: #string<@definy.json>("Delete the module and all its parts")}
                        ])
                      }
                    ])
                  },
                  {key: "required", value: #array<@definy.json>([#string<@definy.json>("module")])}
                ])
              }
            ])
          },
          {
            key: "project_description",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The new English description of the project ('' removes it)")
              }
            ])
          },
          {
            key: "project_descriptions",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("object")},
              {
                key: "description",
                value: #string<@definy.json>("New descriptions of the project by language code, e.g. {\"ja\": \"...\"} ('' removes that language; other languages are kept)")
              }
            ])
          },
          {
            key: "check",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("boolean")},
              {
                key: "description",
                value: #string<@definy.json>("Only type-check the snapshot and report the errors, without taking it (default: false)")
              }
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([#string<@definy.json>("project"), #string<@definy.json>("branch")])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-create-snapshot(arguments: $0, request: $1)
  },
  {
    name: "definy_merge_branch",
    description: "Merge the latest snapshot of a branch into another branch (default main) of the same project, signed by this server's account (only the creator of the target branch can take snapshots on it). Each part is merged three-way from the common snapshot of the two branches: a part changed on only one side takes that change, and a part both sides changed differently takes the merged branch's version (listed in the result). The merge snapshot records the merged snapshot and is type-checked like any snapshot.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The branch to merge")}
            ])
          },
          {
            key: "into",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The branch to merge into (default: main)")}
            ])
          },
          {
            key: "message",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Snapshot message (default: 'Merge <branch> into <into>')")
              }
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([#string<@definy.json>("project"), #string<@definy.json>("branch")])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-merge-branch(arguments: $0, request: $1)
  },
  {
    name: "definy_get_history",
    description: "Show the snapshot history of a branch, newest first. Each snapshot is 'Snapshot <event hash> by <account ID> at <time in ms since 1970>' (with ' (merged <event hash>)' for a merge snapshot), its message indented by two spaces, and the parts it added ('  + module.name'), changed ('  ~ module.name') and removed ('  - module.name') compared with its parent snapshot.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default: main)")}
            ])
          },
          {
            key: "limit",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {key: "description", value: #string<@definy.json>("The number of snapshots to show (default: 20)")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("project")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-get-history(arguments: $0, request: $1)
  },
  {
    name: "definy_run_expression",
    description: "Evaluate an expression in the definy text syntax (the same syntax definy_get_part shows) and return its value as text. Parts are referred to as @module.name: with project (and branch, default main) the parts of that branch are used, including uncommitted-to-main ones, and other parts come from the latest main snapshots. Only the local definy server (node host.js) runs expressions. The expression is type-checked first (in the same type environment as a snapshot) and a type error is returned without running it. An expression that does not terminate never returns.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "expression",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The expression, e.g. '@core.plus(left: 1, right: 2)'")
              }
            ])
          },
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project whose branch parts are used")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default: main)")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("expression")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-run-expression(arguments: $0, request: $1)
  },
  {
    name: "definy_run_tests",
    description: "Run the tests of a project branch: every part named module.test-* (a Boolean) is evaluated, and the test passes when its value is true. Returns one line per test (ok or FAILED with the value) and the counts; the result is an error when a test failed. Snapshots are type-checked, so snapshot the tests (and the parts they test) to a branch first. With compiled: true, the tests are compiled to WebAssembly and run (this checks the compiler). Only the local definy server (node host.js) runs tests.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project whose tests are run")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default: main)")}
            ])
          },
          {
            key: "prefix",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Run only the tests whose module.name starts with this, e.g. 'std.' or 'std.test-string'")
              }
            ])
          },
          {
            key: "compiled",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("boolean")},
              {
                key: "description",
                value: #string<@definy.json>("Compile the tests with core.compile-to-wasm and run the compiled code instead of evaluating them with core.eval-value (default: false)")
              }
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("project")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-run-tests(arguments: $0, request: $1)
  },
  {
    name: "definy_compile_expression",
    description: "Compile an expression in the definy text syntax to a WebAssembly module with core.compile-to-wasm (the compiler that definy.deploy-fetch-worker uses) and return the module as Base64. Parts are found the same way as definy_run_expression. The local definy server (node host.js) uses it to serve the HTML UI of the html-ui project. Only the local definy server compiles expressions.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "expression",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The expression, e.g. 'fn(request$0) => @html-ui.handle(request: $0)'")
              }
            ])
          },
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project whose branch parts are used")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default: main)")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("expression")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-compile-expression(arguments: $0, request: $1)
  },
  {
    name: "definy_receive",
    description: "Copy the events (accounts, snapshots, ...) of another definy server that this server does not have, oldest first, together with their contents. Use it on the local definy server (node host.js) to get the parts of the public server.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "remote",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Origin of the other definy server (default: https://definy.narumincho.com)")
              }
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-receive(arguments: $0, request: $1)
  },
  {
    name: "definy_send",
    description: "Send the events of this server's MCP account that another definy server does not have, oldest first, together with their contents. Use it on the local definy server (node host.js) to publish local snapshots to the public server.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "remote",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Origin of the other definy server (default: https://definy.narumincho.com)")
              }
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-send(arguments: $0, request: $1)
  },
  {
    name: "definy_get_project_branches",
    description: "List every project branch on the definy server (project name, branch name, creator account, snapshot count, the latest snapshot event, and the status of branches other than main: in_progress, review or done). Calls the EventService/GetProjectBranches RPC.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {key: "properties", value: #object<@definy.json>([])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rpc-tool(method: "EventService/GetProjectBranches", arguments: $0, request: $1)
  },
  {
    name: "definy_set_branch_status",
    description: "Set the status of a branch (not main) owned by this server's account: in_progress (the default), review (waiting for review) or done. Only the creator of a branch can change its status (a signed project_branch_status event). Merging the latest snapshot of a branch into main also makes it done. definy_get_project_branches shows the status of each branch.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (not main)")}
            ])
          },
          {
            key: "status",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "enum",
                value: #array<@definy.json>([
                  #string<@definy.json>("in_progress"),
                  #string<@definy.json>("review"),
                  #string<@definy.json>("done")
                ])
              },
              {
                key: "description",
                value: #string<@definy.json>("in_progress (in progress), review (waiting for review) or done")
              }
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([
          #string<@definy.json>("project"),
          #string<@definy.json>("branch"),
          #string<@definy.json>("status")
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-set-branch-status(arguments: $0, request: $1)
  },
  {
    name: "definy_get_events",
    description: "List stored events, newest first. Each event has its hash, account, type, time and the signed event bytes (Base64 CBOR). Calls the EventService/GetEvents RPC.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "eventType",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Only events of this type, e.g. 'project_commit', 'create_account' or 'project_branch_status'")
              }
            ])
          },
          {
            key: "limit",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {key: "description", value: #string<@definy.json>("Max events, 1 to 500 (default 50)")}
            ])
          },
          {
            key: "offset",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {key: "description", value: #string<@definy.json>("Number of events to skip (default 0)")}
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rpc-tool(method: "EventService/GetEvents", arguments: $0, request: $1)
  },
  {
    name: "definy_get_event",
    description: "Get one stored event by its event hash. Calls the EventService/GetEvent RPC.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "eventHash",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The event hash")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("eventHash")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rpc-tool(method: "EventService/GetEvent", arguments: $0, request: $1)
  },
  {
    name: "definy_get_content",
    description: "Get contents from the content-addressed store (Base64) by content hash. Give contentHash for one, or contentHashes for several. Calls the EventService/GetContent RPC.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "contentHash",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("One content hash")}
            ])
          },
          {
            key: "contentHashes",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("array")},
              {
                key: "items",
                value: #object<@definy.json>([{key: "type", value: #string<@definy.json>("string")}])
              },
              {key: "description", value: #string<@definy.json>("Several content hashes")}
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rpc-tool(method: "EventService/GetContent", arguments: $0, request: $1)
  },
  {
    name: "definy_check_missing_hashes",
    description: "Return the content hashes that are not in the content-addressed store yet. Calls the EventService/CheckMissingHashes RPC.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "contentHashes",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("array")},
              {
                key: "items",
                value: #object<@definy.json>([{key: "type", value: #string<@definy.json>("string")}])
              }
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("contentHashes")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rpc-tool(method: "EventService/CheckMissingHashes", arguments: $0, request: $1)
  },
  {
    name: "definy_perf_recent_submits",
    description: "Operator-only performance investigation: the recent SubmitEvent records the definy server host has recorded (newest first). Each record has the total wasm/host milliseconds and a per-segment breakdown: for every service-io request tag, how often it occurred, the wasm ms spent running after it was answered, and the host ms spent servicing it. This is operational data reported by the server itself, so treat it as informational. The MCP connection must send 'Authorization: Bearer <DEFINY_PERF_TOKEN of the server>' (docs/performance-observability.md).",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "limit",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {key: "description", value: #string<@definy.json>("Max records (default 20, max 200)")}
            ])
          },
          {
            key: "allRequests",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("boolean")},
              {
                key: "description",
                value: #string<@definy.json>("Include requests other than SubmitEvent too (default false)")
              }
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-perf-recent-submits(arguments: $0, request: $1)
  },
  {
    name: "definy_list_events",
    description: "List the events of this server newest first. Each event is 'Event <event hash> <type> at <time in ms since 1970> by <account ID> <account name>', followed for create_account by '  name: <name in the event>', and for a snapshot by '  project: ', '  branch: ', '  parts: <number of parts>' and '  message: <first line>'. Use definy_describe_event for the details of one event.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "limit",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {key: "description", value: #string<@definy.json>("Max events (default 50, max 500)")}
            ])
          },
          {
            key: "offset",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("number")},
              {
                key: "description",
                value: #string<@definy.json>("The number of newer events to skip (default 0)")
              }
            ])
          },
          {
            key: "eventType",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Only events of this type (create_account, project_commit or project_branch_status)")
              }
            ])
          },
          {
            key: "accountId",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Only events of this account")}
            ])
          }
        ])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-list-events(arguments: $0, request: $1)
  },
  {
    name: "definy_list_accounts",
    description: "List the accounts that have events on this server, oldest first. Each account is 'Account <account ID> <name>' followed by '  events: <count>', '  first: <ms>' and '  last: <ms>' (the times of its first and last events). The name is the one in its newest create_account event.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {key: "properties", value: #object<@definy.json>([])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-list-accounts(arguments: $0, request: $1)
  },
  {
    name: "definy_describe_event",
    description: "Show an event in text: the same first line as definy_list_events, then for create_account '  name: <name>', and for a snapshot '  project: ', '  branch: ', '  parent: ', '  merged: ', '  next: <snapshots whose parent is this>', '  message:' followed by the message lines indented by four spaces, and '  module <name> (<n> parts)' followed by its parts ('    module.name').",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "eventHash",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The event hash")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("eventHash")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-describe-event(arguments: $0, request: $1)
  },
  {
    name: "definy_find_references",
    description: "List the parts of a branch whose type or expression references the part: the first line is '<n> parts reference ...', then '  module.name' for each part. Use it before deleting a part.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default main)")}
            ])
          },
          {
            key: "part",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The part in the form 'module.name'")}
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([#string<@definy.json>("project"), #string<@definy.json>("part")])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-find-references(arguments: $0, request: $1)
  },
  {
    name: "definy_rename_part",
    description: "Rename a part of a branch of this server's dedicated account (or move it to another module) in one snapshot, changing the references to it in the other parts of the branch (definy_create_snapshot with a new name and delete does not change them). Parts of other projects and branches are not changed.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Project name")}
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch name (default main)")}
            ])
          },
          {
            key: "part",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The part in the form 'module.name'")}
            ])
          },
          {
            key: "to",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("The new name in the form 'module.name'")}
            ])
          },
          {
            key: "message",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The snapshot message (default: Rename <part> to <to>)")
              }
            ])
          }
        ])
      },
      {
        key: "required",
        value: #array<@definy.json>([#string<@definy.json>("project"), #string<@definy.json>("part"), #string<@definy.json>("to")])
      }
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-rename-part(arguments: $0, request: $1)
  },
  {
    name: "definy_run_io",
    description: "Run an expression of type wasi.io (a program that sends HTTP requests, such as html-ui.deploy) to done on this server, and return 'done: <message>' or 'error: <message>' and a line for each I/O. The secrets in the requests are the values kept by this server (entered on the secrets page of its HTML UI; they are never shown to MCP clients). Only on the local definy server.",
    input_schema: #object<@definy.json>([
      {key: "type", value: #string<@definy.json>("object")},
      {
        key: "properties",
        value: #object<@definy.json>([
          {
            key: "expression",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("The expression in definy text, e.g. @html-ui.deploy")
              }
            ])
          },
          {
            key: "project",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {
                key: "description",
                value: #string<@definy.json>("Use the parts of this project (the same as definy_run_expression)")
              }
            ])
          },
          {
            key: "branch",
            value: #object<@definy.json>([
              {key: "type", value: #string<@definy.json>("string")},
              {key: "description", value: #string<@definy.json>("Branch of the project (default main)")}
            ])
          }
        ])
      },
      {key: "required", value: #array<@definy.json>([#string<@definy.json>("expression")])}
    ]),
    handler: fn(arguments$0, request$1) =>
      @definy.mcp-run-io(arguments: $0, request: $1)
  }
]
visibility
public
definy.mcp-tools (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: 7RLb8DznMU5g8u_h5ebcp4VGe8X1gUiUwDkWJzqdhtc
content hash: MAxfCsF-0zgSnQslOlb1WoqGWvCPdm5fko6e2eEek_Y