SiglataDocs
Menu

MCP

Server identity, OAuth scopes, complete tools reference, history, trash and errors.

Server identity

OAuth scopes

ScopeWhat it allows
officeCall every office tool for the company chosen during approval.

Clients may also request openid, profile, email and offline_access. A token without office receives HTTP 403 with insufficient_scope. Scopes never widen the person's access: in Records, each statement runs with the connecting person's read or write permissions. To switch companies or re-authorize, create a new connection via the install guide.

tools/list exposes the same tools to every connection holding office. Results return JSON text and structuredContent (exception: office_status returns English text and {"state": "active"} in structuredContent). While the office is provisioning, only office_status answers; other tools ask to retry in a minute.

Office status

office_status

Reports whether the office is ready: provisioning during setup, active when ready, or failed. Call first after connecting and repeat while provisioning. Read-only.

No arguments. Returns state. With failed, the message asks the owner to contact Siglata support.

Files

Files stores the company's documents by path, such as contratos/2026/acme.pdf. Each save creates a new version, and earlier versions remain readable.

files_save

Saves a file as a new version. Text goes in content; bytes go in contentBase64. Writes without deleting anything.

ArgumentRequiredWhat it is
pathyesThe file's relative path.
noteyesWhat changed, for the company's people.
contentnoThe content as text. Send this or contentBase64.
contentBase64noThe content as bytes, in base64.
contentTypenoThe MIME type. Defaults to text/plain; charset=utf-8 for text and application/octet-stream for bytes.

Returns path and version. Refusals: invalid_input, invalid_path (non-relative, ., .., backslashes, control chars or > 900 bytes), too_large (> 10 MiB), unavailable.

files_upload_begin

Prepares a one-use upload for a local file named by the person, only when the agent has shell access. Up to 50 MiB; expires in 10 minutes. Never show the URL to the person.

ArgumentRequiredWhat it is
pathyesThe file's relative path in Files.
noteyesWhat changed.
sizeyesFile size in bytes, an integer from 1 to 52428800.
contentTypeyesThe file's MIME type.
sha256noSHA-256 as 64 lowercase hexadecimal characters.

Returns uploadUrl, expiresAt (ISO), size and path. Upload with curl --fail-with-body --show-error --silent --max-time 120 -T <file> "<uploadUrl>" (curl.exe in PowerShell), without credentials. Confirm path and version from the PUT response, or verify size and sha256 via files_get with metadataOnly: true after a failure or timeout. Tool refusals: invalid_input, invalid_path, too_large, unavailable (PUT: 400, 404, 409, 413, 503).

files_download_begin

Up to 50 MiB, one attempt, ten minutes. Never show the URL. A remote shell saves there; for manual download, share the console link.

ArgumentRequiredWhat it is
pathyesRelative path.
versionno1 or greater; defaults to current.

Returns downloadUrl and the console url. Download with curl -fsS --output "<destination>" "<downloadUrl>" (macOS/Linux) or Invoke-WebRequest -Uri "<downloadUrl>" -OutFile "<destination>" (PowerShell) and verify local SHA-256. Refusals: invalid_input, invalid_path, not_found, too_large, unavailable (URLs: 404, 503).

files_get

Reads a file: the current version or a requested version. Text files return in content; binary files in contentBase64. Read-only.

ArgumentRequiredWhat it is
pathyesThe file's relative path.
versionnoVersion number starting at 1. Defaults to current.
metadataOnlynotrue: metadata only, without bytes or the 10 MiB limit.

Returns path, version, contentType, size, sha256, note, savedAt, url and, without metadataOnly: true, the content. Refusals: invalid_input, not_found, invalid_path, too_large, unavailable.

files_delete

Deletes a whole file and all its versions. Frees Files space at once; the trash retains it for 30 days. Changes data.

ArgumentRequiredWhat it is
pathyesRelative path.

Returns path, trash, versions and bytes. Refusals: invalid_input, invalid_path, not_found, unavailable.

files_restore

Restores a file and all its versions from the trash. Reclaims its Files space. Changes data.

ArgumentRequiredWhat it is
trashyesThe item id as text, from history_list with kind: "trash".

Returns path, trash, versions and bytes. Refusals: invalid_input, not_in_trash, path_taken, space_full, unavailable.

Records

Records is the company's PostgreSQL database. Each statement runs with the connecting person's permissions. Both tools accept only the arguments below.

records_query

Runs one read-only SQL statement for rows, totals and counts. Read-only.

ArgumentRequiredWhat it is
sqlyesOne SQL statement. Use $1, $2… for values.
paramsnoValues for $1, $2…, in order.

Returns command, rowCount, rows and truncated (capped at 100,000 characters). Refusals: invalid_arguments, PostgreSQL SQLSTATE (42P01, 42501), no-company, not-active, not-member, roles-pending, unavailable.

records_change

Runs one SQL statement that inserts, updates or deletes rows. Each changed row goes into History with the person and agent, and history_undo undoes it. To drop a table or column, run SELECT siglata.drop_table('table') or SELECT siglata.drop_column('table', 'column'). Changes data.

ArgumentRequiredWhat it is
sqlyesOne SQL statement. Use $1, $2… for values.
paramsnoValues for $1, $2…, in order.

Returns action (History action id) and result. Refusals: same as records_query; DROP TABLE and DROP COLUMN are refused and point to the trash functions.

History

History records what each person and agent changed in Records with undo, and the trash keeps dropped tables, columns and deleted files for 30 days.

history_list

Lists, newest first, row changes (entries), actions (actions) and trash items (trash). Read-only.

ArgumentRequiredWhat it is
kindnoentries, actions or trash. Without it, all three lists.
tablenoOnly items touching this table.
personnoA current member's name or email.
ainoThe agent's name, as shown in the list.
sincenoOnly from this timestamp forward.
beforenoSmallest id returned for pagination. Requires kind.
limitnoItems per list, from 1 to 200 (default: 50).

Refusals: same as records_query, plus ambiguous_person when two members share the given name.

history_undo

Undoes row changes in Records or restores a trash item. Send one target. With a primary key, undo matches by key; without one, it matches all row values (identical rows are refused with 55000). Schema changes (CREATE TABLE, ALTER TABLE) cannot be undone. Changes data.

ArgumentRequiredWhat it is
entrynoUndoes one row change.
actionnoUndoes every row change made by one records_change call.
trashnoRestores a dropped table or column from trash (for files, use files_restore).

Returns undone and result. Refusals: already_undone, already_restored, not_found, not_a_change, 42704, 55000, 40001 (undo newer changes on the same row first) and records_query refusals.

Errors

Tool refusals

Tool refusals return isError: true, plain-language text and structuredContent with error (stable code) and message:

{
  "error": "not_found",
  "message": "Files has no file at contratos/2026/acme.pdf."
}

Request refusals

SituationResponse
Missing or invalid tokenHTTP 401 with WWW-Authenticate
Token lacks office scopeHTTP 403 with insufficient_scope
Connection expired/revoked or user left companyHTTP 401 with invalid_token
Cross-origin browser requestHTTP 403 with JSON-RPC -32000
Unknown toolJSON-RPC -32602
Unexpected failureHTTP 500 with JSON-RPC -32603