# get_table_schema (https://sellersheetai.com/docs/mcp-api/tools/get_table_schema)

> Return the schema for one rpt_* table — column names, types, unique key.

Access: **READ** · toolset sellersheet · family null

Cheaper than loading the full report-data skill when you already know which table you need and just want column names to build a query. For business-question → table mapping (e.g. "what table answers 'restock needs'?"), per-column gotchas, calibration notes, or the cross-table workflow (manual create-poll-download, disabled_reason decoding) — load the 'report-data' skill instead. This tool returns the schema only; it does NOT teach which table to use.

## Call it

MCP tool call:

```json
{
  "name": "get_table_schema",
  "arguments": {
    "table_name": "<table_name>"
  }
}
```

Tool API (early access — contact us):

```bash
curl -X POST https://api.sellersheetai.com/api/v1/tools/get_table_schema \
  -H "Authorization: Bearer $SELLERSHEET_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"table_name":"<table_name>"}'
```

## Arguments

| Name | Type | Required | Description |
|---|---|---|---|
| `table_name` | string | yes | physical rpt_* table (e.g. 'rpt_orders'), a friendly alias ('rpt_listings' → rpt_get_merchant_listings_all_data), OR an Amazon report-type name ('GET_FBA_MYI_ALL_INVENTORY_DATA', 'spCampaigns' — case-insensitive). Resolved server-side. |

## Result

- `data.table_name` — the resolved physical table.
- `data.resolved_from` — the ref you passed, when it differed (else null).
- `data.columns` — [{name, type, nullable, default, note}] — note is a per-column trap (e.g. the days_of_supply NULL-sort trap) or null.
- `data.unique_constraint` — the dedup key; on a snapshot/roster table its marketplace column (country_code, country, marketplace_id, profile_id) is what report_date='latest' resolves one date per.
- `data.indexes / data.fed_by_report_types / data.notes` — indexes ({name, columns, unique}), the Amazon report types that feed the table, and table-level warnings (PII-blocked, schema-variant, retired/aliased; empty when healthy).

## Gotchas

- 400 — ref not resolvable to an allow-listed table. The error carries the full available_tables list + a fuzzy suggestion; a retired report-type name names its replacement.