deep_answer
Run SQL in steps to answer data questions: explore real values, add tables, repair rejected queries, then return rows with a step-by-step trace. Use for value-specific or multi-table questions.
Instructions
Like answer, but able to work in steps (mode 'adaptive', the default, tries one plain query first and only works in steps when it fails or comes back empty; mode 'deep' always does): the server's model may run small exploring queries to see real values (how a status or country is spelled, a date format, whether a join matches), ask for more tables, and fix a query the database rejected, before running the final query. Every query goes through the same read-only and caller-scope checks as run_query. Returns the rows plus a step-by-step trace (each step's SQL and outcome) and what was sent to the model. Off unless the server enables it (SCHEMAGATE_MCP_DEEP=1), because exploring rows go to the model provider; use it for questions that name values or span several tables, and answer for simple ones.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"question": "<question>"
},
"name": "deep_answer"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'adaptive' (default): one plain query first, and the step-by-step path only when that one fails, comes back empty or is all zero -- most questions cost one model call. 'deep': always work in steps. | adaptive |
| 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. | |
| max_rows | No | Most rows to return (default 50, at most 200). The result says when it was truncated. | |
| question | Yes | The user's question in plain language, e.g. 'revenue by month' or 'which customers owe us money'. | |
| max_steps | No | Most model calls for this question (default 6, at most 12). Each exploring query, request for more tables, repair and final query is one; a plain question uses one. | |
| 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |