# get_collection_schema

Source: https://modulify.ai/docs/mcp/database/get-collection-schema

Reads the columns of one table in a site database, with their types, nullability, primary key and CMS field type.

- Title: Read a collection schema
- Scope: `data:read`
- Access: Read only

Each column carries its `uiType`, the CMS field type registered for it, such as `image`, `richtext` or `code`, or null. A language column with no type of its own reports its base field's type when that type is `color`, `richtext`, `code`, `file`, `image`, `date` or `datetime`. A `code` value is raw HTML, CSS or JavaScript that the site runs exactly as written.

A foreign key column names the table and column it points at in `references`, and on the older database a column of an enum type names that type in `udtName`, which is what `list_enum_options` takes. Read this before writing a row with `create_row` or `update_row`, so the right columns are supplied. See [Column types](https://modulify.ai/docs/data/column-types).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `schema` | string | No | The schema the collection lives in, exactly as `list_collections` reports it. Leave it out to use the site database's own default, which is right unless `list_collections` showed something else. A site on the newer database always uses its default. |
| `name` | string | Yes | The table name, from `list_collections`. |