search_schema
Find the database tables relevant to a natural language question, returning their DDL, columns, and foreign-key relationships so you can write joins without examining the entire schema.
Instructions
Find the tables relevant to a question and return their DDL.
Prefer this over trying to read the whole schema. The schema is far larger than the part of it any one question needs, and sending all of it costs context you will want for the answer. Pass the user's question in natural language, not a table name guess: this ranks on column names, types and the schema's own comments.
Returns the highest-scoring tables with their columns and keys, plus the foreign-key edges between the returned tables, which is what you need to write the joins.
On failure or a disappointing result:
If a table you know you need is missing from the results, call describe_table with its name. Retrieval ranks, and a needed table can fall below the cutoff; describe_table is the escape hatch and does not depend on the ranking.
If nothing looks relevant, re-ask with the domain words the user used (for example "reseller", "purchase order", "pay history") before widening limit. Raising limit costs tokens and rarely fixes a vocabulary mismatch.
Do not invent table names. If you cannot find it here, say so.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| question | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Guidance for the model, including what to do if the table it needs is absent. | |
| tables | Yes | ||
| backend | Yes | Retrieval backend that ranked these tables: 'bm25' or 'titan'. | |
| question | Yes | ||
| tokenizer | Yes | Which tokenizer produced the counts. | |
| foreign_keys | No | Foreign-key edges *between tables in this slice*, so joins can be written without fetching more schema. | |
| estimated_tokens | Yes | Token count of this slice's DDL, by the tokenizer named in tokenizer. | |
| full_schema_tokens | Yes | Token count of the entire schema's DDL, for comparison with estimated_tokens. |