# MCP tools

> Every tool of the Architure MCP server, what it reads or writes, its inputs, what it answers and the permission it needs; then authentication, limits, errors and how objects are named.

Source: https://docs.architure.dev/docs/mcp-tools

The Architure MCP server is at `https://app.architure.dev/api/mcp` (Streamable HTTP; the server's name is `architure`). It has 15 tools: five read the workspace (repositories, tech stack, skills, environment variable names), six read databases, and four write databases. [Connect your agent](/docs/connect-your-agent) sets it up; the [skill](/docs/skill) tells the agent in which order to call the tools.

Every answer is text: JSON for most tools, Architure's [text format](/docs/text-format) for `get_database`. A refusal comes back as a tool error whose first word is its code (see [Errors](#errors)).

## The tools at a glance

| Tool | Group | Needs | What it answers |
| --- | --- | --- | --- |
| `list_repositories` | Workspace | read | The imported repositories (`owner/name`) and their packages |
| `list_tech_stack` | Workspace | read | The tech stack by category, with doc links, notes, linked variable names and skills |
| `list_skills` | Workspace | read | The skills of a package, or of the organization |
| `get_skill` | Workspace | read | One skill's files |
| `list_environment_variables` | Workspace | read | The variable names of a package, or of the organization; never a value |
| `list_databases` | Database | read | The databases of a package, or of the organization |
| `get_database` | Database | read | A database, or one schema, in the text format, with its revision |
| `get_table` | Database | read | One table in detail |
| `search_columns` | Database | read | Columns across the organization's databases |
| `list_column_definitions` | Database | read | The organization's column definitions |
| `check_database` | Database | read | The database's issues and how to fix them |
| `create_table` | Database write | write | Creates a table with its columns, foreign keys and indexes |
| `update_column` | Database write | write | Changes one column |
| `set_description` | Database write | write | Writes a description from Markdown |
| `apply_operations` | Database write | write | Applies raw operations, all or nothing |

**read** is any API key or an OAuth token with `schema:read`. **write** is a write API key, or an OAuth token with `schema:write` for an owner, admin or member of the organization. See [Authentication](#authentication).

## Telling the tools where you work

The organization's work is organized by [repositories](/docs/repositories) and their packages: the folders that run with their own environment, such as `apps/web` or `packages/email` (`.` for a repository without workspaces). Databases, skills and environment variables are each linked to packages or available to all packages.

`list_skills`, `list_environment_variables` and `list_databases` take two optional inputs that name the package:

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `repository` | string, 3 to 200 characters | no | The GitHub repository as `owner/name`, as `git remote get-url origin` shows it (case does not matter). Left out, the tool answers for the whole organization |
| `path` | string, up to 500 characters | no | The folder you work in, from the repository's root (`apps/web`, or a folder inside it). Read only with `repository`; left out, the repository's root package |

The answer is then for the package that holds the folder: the deepest package whose path is the folder or one of its parents, else the root package. It names that package first (`package`: `repository`, `path`, `name`). A repository the organization did not import, or a folder that no package holds (in a monorepo whose root is not a package), answers `NotFound`: call `list_repositories`, or leave `repository` out.

## Workspace reads

### list_repositories

The GitHub repositories the organization imported, each with its packages. Use it to check that your repository is there and which folder is a package.

**Inputs:** none.

**Answers:** `repositories`, each with `repository` (`owner/name`), `private`, `defaultBranch` and `packages` (`path`, `name` from its `package.json`).

**Needs:** read.

### list_tech_stack

The organization's [tech stack](/docs/tech-stack): its preferred technologies and libraries. Agents read it before choosing a library, framework or service, prefer what it lists and follow the docs it links to.

**Inputs:** none. The tech stack is the organization's, not a package's.

**Answers:** `categories`, the categories that have items in their fixed order, each with its `name` and `items` in the team's order: `id`, `name`, `version`, `docUrls`, `notes` (Markdown), `environmentVariables` (the names of the variables linked to the item) and `skills` (the names of the skills linked to it).

**Needs:** read.

### list_skills

The team's [skills](/docs/skills): folders with a `SKILL.md`, instructions the team wants agents to follow. Archived skills and skills in the trash are left out.

**Inputs:** `repository` and `path` (see [Telling the tools where you work](#telling-the-tools-where-you-work)).

**Answers:** `skills` (with `package` when `repository` is given): those linked to the package or available to all packages, else every live skill of the organization. Each has `name`, `description`, `source` (`skills_sh` or `custom`), `skillsShId` (the skills.sh id of a copy from skills.sh, else null), `audit` (each audit partner's `provider` and `status`, or `not audited`) and `files` (how many files it has).

**Needs:** read.

### get_skill

One skill's files, by name. The agent follows its instructions; to install it in a repository, it writes the files under `.agents/skills/<name>/` (or wherever the user's agent reads skills). A repository can also install every skill its packages use with its [install link](/docs/skills#install-link).

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `name` | string, 1 to 64 characters | yes | The skill's name, from `list_skills` |

**Answers:** `name`, `description`, `source` and `files`, each with its `path` (`SKILL.md` first at the root, then supporting files such as `references/api.md`) and `contents`. A name that is not a live skill answers `NotFound`.

**Needs:** read.

### list_environment_variables

The [environment variable](/docs/environment-variables) names the code reads, with their descriptions. Never the values: the agent uses the names in code (`process.env.STRIPE_SECRET_KEY`), asks the user for a value when it needs one, and never writes a value into a committed file.

**Inputs:** `repository` and `path` (see [Telling the tools where you work](#telling-the-tools-where-you-work)).

**Answers:**

- With `repository`: `package` and `environmentVariables`, the names that package resolves to, each with `name`, `description` and `scopes`: each scope that holds a value (`all`, `production`, `preview`, `development`) with its `source`, `package` (the variable is linked to the package, which wins) or `allPackages` (available to every package).
- Without: `environmentVariables`, every variable of the organization, with `name`, `description` (Markdown) and `scopes` (the scopes that hold a value).

An environment's own value overrides `all`.

**Needs:** read.

## Database reads

### list_databases

The [databases](/docs/databases), most recently changed first. Every database tool takes a `databaseId` from this list.

**Inputs:** `repository` and `path` (see [Telling the tools where you work](#telling-the-tools-where-you-work)).

**Answers:** `databases` (with `package` when `repository` is given): those the package uses (linked to it or available to all packages), else every database of the organization. Each has `id`, `name`, `dialect` (`postgresql` or `mysql`), `revision`, `updatedAt`, `schemas` (the names of its schemas, in the canvas's order) and `description` (Markdown). Archived databases and databases in the trash are left out.

**Needs:** read.

### get_database

One database in Architure's [text format](/docs/text-format) (DBML plus `type:` for information types, `use:` for column definitions, and table groups for areas), with its current revision: the `baseRevision` of the write tools.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database, from `list_databases` |
| `schema` | string | no | Only this schema, by name or id: its tables, the relationships between them and the areas that hold one. Relationships with other schemas' tables are counted, not shown. Default: the whole database |
| `includeIds` | boolean | no | Also list the id of every schema, table, column, relationship, index, area and column definition, for `apply_operations`. A definition marked `archived` is archived or in the trash: columns may not link to it anew |

**Answers:** a header (the database's name, id, dialect and revision; its schemas with their table counts; whether the connection may write, else why not: a read key or a viewer, or a plan that is not active), then the text format, then the ids when asked. An unknown schema is refused with the names there are.

**Needs:** read.

### get_table

One table in detail, as JSON. Use it for the descriptions, which the text format leaves out.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `table` | string | yes | `schema.table` (`public.orders`), `table` when the name is unique across schemas, or the table's id |

**Answers:** `revision` and `table`: `id`, `path`, `schema`, `name`, `description`, `area`, `primaryKey` (column names), `columns` (each with `id`, `name`, `position`, `dataType`, `enumValues`, `nullable`, `defaultValue`, `isPrimaryKey`, `isUnique`, `isAutoIncrement`, `informationType`, `columnDefinition` and `description`; a column linked to a column definition shows the definition's type, values, information type and description), `relationships` that start or end on the table (`id`, `name`, `kind`, `direction`, `from`, `to`, `cardinality`, `onDelete`, `onUpdate`, `description`) and `indexes` (`id`, `name`, `isUnique`, `columns`). Descriptions are Markdown.

**Needs:** read.

### search_columns

Finds columns across every live database of the organization, so the agent reuses the names and types already chosen (how is an email stored elsewhere? which columns use the `order_status` enum?). Filters combine.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `name` | string, up to 200 characters | no | Part of the column name, without case: `email` finds `email`, `billing_email`, `EmailVerified` |
| `dataType` | string, up to 200 characters | no | Part of the data type (`timestamp`, `varchar`, `uuid`). A linked column matches on its definition's type and name, so an enum definition's name finds the columns that use it |
| `informationType` | one of the seven [information types](/docs/information-types) | no | Only columns of this type (a linked column has its definition's) |
| `databaseId` | uuid | no | Only this database |
| `limit` | integer, 1 to 200 | no | The most results, 50 by default |

**Answers:** `count`, `truncated` (with a `note` when more columns match) and `columns`, each with `databaseId`, `databaseName`, `dialect`, `schemaName`, `tableId`, `tableName`, `columnId`, `columnName`, `path` (`schema.table.column`), `dataType`, `informationType`, `columnDefinition` (`id` and `name`, or null), `nullable`, `isPrimaryKey` and `isUnique`.

**Needs:** read.

### list_column_definitions

The organization's [column definitions](/docs/column-definitions): shared enums and column types. Agents link a column to a definition instead of repeating an enum's values.

**Inputs:** none.

**Answers:** `columnDefinitions` (archived ones and those in the trash left out), each with `id`, `name`, `dialect` (null: it works in PostgreSQL and MySQL), `dataType`, `enumValues`, `informationType`, `nullable`, `defaultValue` and `description` (Markdown). A column links only to a definition of its database's dialect or with `dialect` null, by name, or by id when two share a name.

**Needs:** read.

### check_database

Lints the database, as the canvas's [issues](/docs/issues) panel does. Agents call it after every change they write, fix the errors, and fix the warnings unless the user decided otherwise.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `severity` | `error`, `warning` or `info` | no | List only this severity. By default errors and warnings are listed and information issues are counted per rule |
| `limit` | integer, 1 to 1000 | no | List at most this many issues, errors first (100 by default) |
| `includeAll` | boolean | no | List every issue, without a limit |

**Answers:** `revision`; `summary` (the number of `errors`, `warnings` and `info`); `rules`, each rule found once with its `severity`, `title` and `fix`; `issues`, each with `rule`, `severity`, `message` and `target` (`kind`, `id`, `path`); `omitted`, how many were not listed; `infoByRule`, the information issues counted per rule with up to 10 example paths; and `next`, what to do about what was left out.

**Needs:** read.

## Database writes

Every write is one change of the database, with the agent as its author: the open canvas shows it within seconds. Each write tool takes `baseRevision` (see [Revisions and conflicts](#revisions-and-conflicts)) and answers with the new `revision` and `next`, a reminder to call `check_database`.

Writes are refused with `Forbidden` for a read key, a token without `schema:write` or a viewer, and with `PlanRequired` once the organization's trial is over or its subscription is not active.

### create_table

Creates a table with its columns in one change, placed on the canvas to the right of the existing tables, with its foreign keys and single-column indexes. Refused when the schema already has a table of that name.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `baseRevision` | integer | no | The revision the agent read; left out, the current one |
| `schema` | string | no | The schema's name or id. Default: `public`, or the database's only schema |
| `name` | string | yes | The table's name, following the database's naming |
| `description` | Markdown, up to 20,000 characters | no | What the table holds and why |
| `columns` | array, 1 to 500 | yes | The columns, in order (below) |

Each column:

| Field | Type | Required | What |
| --- | --- | --- | --- |
| `name` | string | yes | The column's name |
| `dataType` | string | no | The type as the dialect writes it in DDL (`uuid`, `varchar(255)`, `numeric(10,2)`, `timestamp with time zone`). Left out when `definition` is set |
| `definition` | string | no | A column definition's name or id: the column then reads its type, values, information type and description |
| `nullable` | boolean | no | Default: false for a primary key column, the definition's for a linked column, true otherwise |
| `defaultValue` | string or null | no | The SQL default as written in DDL (`now()`, `'draft'`) |
| `primaryKey` | boolean | no | Part of the primary key; several columns make a composite key |
| `unique` | boolean | no | Values must be unique |
| `autoIncrement` | boolean | no | Filled by a sequence or identity |
| `informationType` | one of the seven information types | no | What the column holds |
| `references` | string | no | Makes the column a foreign key to `schema.table.column`, `table.column` or a column id (the new table's own columns too). Many-to-one, or one-to-one when the column is unique or the only primary key column; named `<table>_<column>_fkey` |
| `onDelete` | `no_action`, `restrict`, `cascade`, `set_null` or `set_default` | no | The foreign key's ON DELETE action |
| `index` | boolean | no | An index on this column alone; set it on foreign keys that do not start the primary key, or `check_database` warns |
| `description` | Markdown | no | What the column holds, its unit or format |

**Answers:** `revision`, `table` (`id`, `path`, and `columns`: each column's name with its id), `relationships` (the names of the foreign keys created) and `next`.

**Needs:** write.

### update_column

Changes one existing column. Send only the fields that change. To add, delete or reorder columns, or to change relationships and indexes, use `apply_operations`.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `baseRevision` | integer | no | The revision the agent read |
| `column` | string | yes | `schema.table.column` (`public.orders.status`), `table.column`, or the column's id |
| `changes` | object | yes | At least one of the fields below |

`changes` takes `name` (renames the column, which keeps its identity), `dataType` (unlinks a linked column), `definition` (links the column to a definition by name or id; null unlinks it and keeps the definition's type as the column's own; not together with `dataType`), `nullable`, `defaultValue` (null removes it), `primaryKey`, `unique`, `autoIncrement`, `informationType` (null clears it) and `description` (Markdown; null or empty clears it).

**Answers:** `revision`, `column` (`id` and `path`), a `note` when the description was set on a linked column (readers show the definition's description), and `next`.

**Needs:** write.

### set_description

Writes the description of the database, a schema, a table, a column or a relationship from Markdown, replacing the whole description. It is stored as sanitized rich text and shown in the canvas's editor.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `baseRevision` | integer | no | The revision the agent read |
| `kind` | `database`, `schema`, `table`, `column` or `relationship` | yes | What to describe |
| `target` | string | for all but `database` | A schema name, `schema.table`, `schema.table.column`, a relationship's constraint name, or any id |
| `markdown` | string or null, up to 20,000 characters | yes | Paragraphs, `##` and `###` headings, bold, italic, code, links, lists and fenced code blocks are kept; other markup is dropped. Null or empty clears it |

**Answers:** `revision`, `described` (`kind` and `path`), a `note` for a column linked to a definition, and `next`.

**Needs:** write.

### apply_operations

The general write tool, for what the other three do not cover: adding, deleting or reordering columns; relationships, indexes, areas and schemas; moves and deletes. The operations apply in order, all or nothing, as the canvas applies its edits.

| Input | Type | Required | What |
| --- | --- | --- | --- |
| `databaseId` | uuid | yes | The database |
| `baseRevision` | integer | yes | The revision the operations were written against |
| `operations` | array, 1 to 1000 | yes | Operations, each discriminated by `type` |

The operation types are `database.update`; `schema.create`, `schema.update`, `schema.delete`; `table.create`, `table.update`, `table.move`, `table.delete`; `column.create`, `column.update`, `column.reorder`, `column.delete`; `relationship.create`, `relationship.update`, `relationship.delete`; `area.create`, `area.update`, `area.move`, `area.delete`; `index.create`, `index.update`, `index.delete`; and `database.import`.

- A create carries the whole row with a new id the agent makes (a uuid, v7 preferred). An update carries `id` and only the changed fields in `changes`. A delete carries `id` and cascades as the database does: deleting a table removes its columns, indexes and relationships.
- Ids come from `get_database` with `includeIds`, or from `get_table`.
- Descriptions inside operations are `descriptionHtml`, sanitized on the server; `set_description`, which takes Markdown, is simpler.

**Answers:** `revision` and `next`. An operation that does not apply is a `ValidationError` naming it.

**Needs:** write.

## Addressing objects

Tools name objects by path:

| Object | Path | Example |
| --- | --- | --- |
| Schema | its name | `public` |
| Table | `schema.table`, or `table` when the name is unique across schemas | `public.orders` |
| Column | `schema.table.column`, or `table.column` when the table name is unique | `public.orders.status` |
| Relationship | its constraint name | `orders_customer_id_fkey` |
| Column definition | its name | `order_status` |

Exact names match first, then names without case. Ids (uuids) work everywhere a path does. A name that matches several objects (a duplicate, or names that differ only in case) is refused with their paths and ids, never resolved to the first: the agent sends the id.

## Revisions and conflicts

Each database has a revision, a counter that moves with every change. `get_database`, `get_table`, `check_database` and every write answer with it. A write names the revision it was based on (`baseRevision`; required by `apply_operations`, the revision just read when the other write tools get none).

When the database has moved past it, someone else (the canvas, another agent) changed it in between: nothing is written and the answer is a `Conflict` with the current revision and the changes since, with their operations in full while they fit in about 20 KB (an import shown by its counts), else outlined by operation types and target ids. The agent reads the database again, redoes its change on the current schema and retries with the new revision.

## Authentication

Every request carries a bearer token: `Authorization: Bearer <token>`. A request without one, or with one the server refuses, answers `401` with a `WWW-Authenticate` header that points at the server's OAuth metadata (`resource_metadata`, at `/.well-known/oauth-protected-resource/api/mcp`) and asks for the scopes `schema:read schema:write`, so an agent that supports OAuth starts the sign-in by itself.

### API keys

An organization API key starts with `architure_`. An owner or admin creates it on **Agents** with the permission **Read** or **Read and write** (see [Create an API key](/docs/connect-your-agent#create-an-api-key)).

- **Read** calls every read tool. The write tools answer `Forbidden`: an owner or admin creates a write key.
- **Read and write** calls every tool.

A key acts for the organization; its changes are signed with the agent's name and the key's name. It is never challenged for a scope.

### OAuth

Any other bearer token is an OAuth access token, issued after the user signs in and chooses the organization on the consent page. Its scopes are `schema:read` and `schema:write`, limited by the user's role, which is read again on every call: an owner, admin or member writes with `schema:write`; a viewer only reads, whatever the scopes; a user who left the organization is refused.

A write tool called with a token that lacks `schema:write` answers `403` with an `insufficient_scope` challenge asking for `schema:read schema:write`, so the agent can ask the user to sign in again with write access. A viewer's token that has the scope gets `Forbidden` from the tool instead.

## Rate limit

An API key may make 600 requests a minute. Past it the server answers `429` with `Retry-After: 60`. One MCP request counts once, whatever the tools do inside it.

## Errors

A refused call comes back as a tool error whose first word is its code, then the reason and what to do. Before any tool runs, the HTTP layer may answer `401`, `403`, `429` or `500` instead.

| Code | When | What the agent does |
| --- | --- | --- |
| `Conflict` | The database moved past `baseRevision`; the answer lists the changes since | Read the database again, redo the change, retry with the new revision |
| `ValidationError` | An input or an operation does not apply; `operations.<index>` names the operation, and the message starts with `not_found`, `already_exists`, `invalid_reference`, `invalid_row` or `invalid_operation` | Fix the input and retry |
| `PlanRequired` | A write while the organization's trial is over or its subscription is not active | Tell the user: an owner or admin restores writing in the billing settings. Reads still work. Do not retry |
| `Forbidden` | A write with a read key, a token without `schema:write` or a viewer's connection | Tell the user. Do not retry |
| `NotFound` | No database with that id, no live skill of that name, a repository the organization did not import, or a folder no package holds | Call `list_databases`, `list_skills` or `list_repositories` again |
| `401 Unauthorized` | No token, an unknown, revoked or expired one, or a token without an organization | Sign in again, or check the key |
| `429` | The API key passed 600 requests in a minute | Wait for `Retry-After` |

A path that matches nothing, or several objects, is refused with a message that says which (and lists the candidates' ids), and nothing is written.
