Skip to main content
Glama

deep_answer

Read-only

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

NameRequiredDescriptionDefault
modeNo'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
rolesNoThe 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_kNoHow 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_rowsNoMost rows to return (default 50, at most 200). The result says when it was truncated.
questionYesThe user's question in plain language, e.g. 'revenue by month' or 'which customers owe us money'.
max_stepsNoMost 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.
principalNoWho 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

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.15.1

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, openWorldHint=true; the description adds genuinely non-derivable facts: it is gated behind SCHEMAGATE_MCP_DEEP=1, exploring rows are sent to the model provider (a privacy/cost disclosure), all queries pass the same read-only and caller-scope checks as run_query, and the response includes a step-by-step trace plus the prompt sent to the model. It does not contradict idempotentHint=false, though it never explicitly says repeated calls may produce different traces.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the sibling comparison and the key caveat, and every sentence carries information (feature flag, privacy, permissions, return shape). It is, however, one very long nested-parenthesis block that is harder to scan than it needs to be.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present the description needn't detail return values, and it still notes the trace and model payload. Combined with the feature-flag gate, provider-exposure warning, step budget, and permission model, an agent has everything needed to decide and call correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so every parameter (mode, roles, top_k, max_rows, max_steps, principal, question) is already documented in the schema. The description largely restates the mode default and step behavior that the schema already spells out, adding only the 'all zero' refinement; baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens by anchoring to the sibling ('Like answer, but able to work in steps'), then specifies the mechanism: the server's model may run exploring queries, request more tables, and repair rejected queries before the final query. An agent can distinguish this from answer and run_query without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit routing: 'use it for questions that name values or span several tables, and answer for simple ones.' It also distinguishes the two modes (adaptive vs deep) with the condition that selects each, so both the when-to-use and the when-not-to-use are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.