select_schema
Start here for any question about the data. Returns the few tables and views the question needs, as compact DDL to write SQL against, scoped to the caller: objects and columns they may not read are absent, not ranked low. Also returns each object's name and why it was picked. Pass principal and roles whenever you know who is asking.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roles | No | The caller's roles or groups, e.g. ['finance', 'payroll']. Objects and columns restricted to a role are visible only when it is listed here. Omitted = no roles. | |
| top_k | No | How many tables and views to select for the question (default 6). Raise it for questions that span many areas; the caller's visible objects are the upper bound. | |
| question | Yes | The user's question in plain language, e.g. 'revenue by month' or 'which customers owe us money'. | |
| principal | No | Who is asking, as an identity string such as 'okta:jdoe'. Pass it whenever you know the user: visibility is decided for this identity. Omitted = anonymous, which sees only unrestricted objects. | |
| expand_foreign_keys | No | Also pull in tables joined by foreign key to the selected ones (default true), only where the caller may read them. Set false for the bare top matches. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |