# MCP tool reference Interfold MCP tools map to the normal REST resources. Tool responses preserve the API's structured JSON. List tools accept optional `limit` and `offset` and return their resource-specific array plus `pagination`; continue with `pagination.nextOffset` while `pagination.hasMore` is true. ## Sites | Tool | Effect | | ------------- | ----------------------------------------------------- | | `list_sites` | List sites in the authorized account. | | `create_site` | Create a Site, optionally with an existing bucket. | | `get_site` | Read one Site and reconciliation state. | | `update_site` | Change name, access, status, or retry reconciliation. | See [Sites API](/api-reference/sites). ## Buckets | Tool | Effect | | --------------- | --------------------------- | | `list_buckets` | List account-owned buckets. | | `create_bucket` | Create storage. | | `get_bucket` | Read bucket metadata. | | `update_bucket` | Rename a bucket. | See [Buckets API](/api-reference/buckets). ## Files | Tool | Effect | | ---------------------- | ----------------------------------------------------------------------------------------------- | | `list_files` | List files or find an exact path. | | `read_file` | Read text content and metadata up to 256 KiB. | | `write_file` | Create or replace a complete text file. | | `delete_file` | Delete a file. | | `list_file_versions` | List recent revisions using `bucket_id` and stable `file_id`. | | `read_file_version` | Read historical text using bucket, file, and version IDs, up to 256 KiB. | | `restore_file_version` | Restore content using `bucket_id`, `file_id`, `version_id`, and an expected current version ID. | All file tools take an explicit `bucket_id`; history tools also take the stable `file_id` returned by file metadata. The file must belong to that bucket. Get a bucket ID from `get_site` or `list_buckets`. The 256 KiB text limit protects agent context and is an Interfold MCP client policy, not an MCP protocol limit. Download larger or binary revisions through the [Files API](/api-reference/files) or CLI. `write_file` accepts optional `expected_current_version_id` for conflict protection and returns the saved version ID. A restore creates another version; it does not change the file path or access rules. ## Functions | Tool | Effect | | ---------------- | ------------------------------------------- | | `list_functions` | List deployed functions and current status. | Deploy by writing source to `/api/.ts`; there is no separate MCP deploy tool. See [Functions API](/api-reference/functions). ## Databases | Tool | Effect | | -------------------------- | ----------------------------------------------- | | `list_databases` | Inspect the site database and binding state. | | `query_database` | Run potentially mutating SQL with site and database IDs. | | `create_database` | Create or resume site provisioning with optional retained `idempotencyKey`. | | `list_database_migrations` | List successful cloud migration metadata. | | `get_database_migration` | Read one successful receipt and its stored SQL. | | `apply_database_migration` | Apply one migration with explicit confirmation. | Legacy tools above take `site_id`; `query_database` also takes `database_id` and runs potentially mutating SQL. | Account tool | Effect | | --- | --- | | `list_account_databases` | List databases owned by the authorized account. | | `create_account_database` | Create unattached storage with required retained `idempotencyKey`. | | `get_account_database` | Get metadata by `database_id`. | | `query_account_database` | Run potentially mutating SQL by `database_id`. | | `list_account_database_migrations` | List successful receipts. | | `get_account_database_migration` | Read a receipt by `name`, including stored SQL when available. | | `apply_account_database_migration` | Apply exact `migration` with `confirm: true`. | | `apply_account_database_migrations` | Apply ordered `migrations` prefix with `confirm: true`. | | `list_account_database_exports` | List exports. | | `create_account_database_export` | Start an export. | | `reconcile_account_database_export` | Reconcile `export_id` within its database. | | `create_account_database_deletion_challenge` | Request an expiring deletion challenge. | | `delete_account_database` | Delete unattached storage with returned `confirmationCode`. | | `attach_account_database` | Explicitly attach to same-account `site_id`. | | `detach_account_database` | Explicitly detach from same-account `site_id`. | All resource operations take the stable `database_id`. The account comes from the current API key. Export access requires admin role for browser and CLI session users; manual account write keys retain their REST permissions. Creation retries must preserve account, target and the original key. There is no `/provision` endpoint. `POST /databases/:databaseId` updates only the display name and never provisions storage. Keys retain historical intent after detach and deletion: `DATABASE_CREATION_DELETED` and `DATABASE_CREATION_REQUEST_MISMATCH` must not trigger hidden replacement storage. Attachment changes are enabled in production after the runtime upgrade/audit and legacy worker retirement. Respect `DATABASE_ATTACHMENTS_DISABLED` if the current deployment places changes on hold. Ownership alone grants no runtime access. Attached databases reject deletion, and site deletion requires explicit detach. See [Databases API](/api-reference/databases). ## Secrets | Tool | Effect | | --------------- | --------------------------------------- | | `list_secrets` | List names and metadata without values. | | `set_secret` | Create or replace a secret. | | `delete_secret` | Delete a secret. | There is intentionally no `get_secret` tool. See [Secrets API](/api-reference/secrets).