Skip to main content
Glama

Suggest a Request for approval

suggest_approved_query

Suggest a reusable parameterized query for approval. A query's text is either a statement in the datasource's dialect or an operation of a module published to the Request Service; request_kind says which, and the fields for the other kind are left out. For request_kind "operation", omitting parameters carries the operation's declared parameters; a supplied list must include every parameter the operation requires and no parameter it does not declare. After validation, the query stays pending for review, even when direct query management is enabled. The response includes its browser approval URL. Use this when you discover a useful query pattern that should be saved for future use. Policy scope resolution reads the statement to name the tables and columns it reaches. A statement it cannot follow raises a scope_unresolved objection for an Administrator to review; browser approval requires confirmation, while MCP query-management authority records the objection without blocking. It follows SELECT, INSERT, UPDATE and DELETE; non-recursive WITH clauses; derived tables and VALUES lists in FROM, each with an alias; joins, WHERE, GROUP BY, HAVING and ORDER BY; and parameters written as {{name}}. For authoring, a write must not start with WITH; move the CTE into a derived table in the write's FROM or USING clause, and a write inside a CTE body becomes the statement itself, with RETURNING if its rows are needed. It does not follow WITH RECURSIVE, a subquery inside a select item or a predicate (write it as a join or a WITH clause), or a table or column that is not in this datasource's schema (check it with get_schema). At the top level, UNION, INTERSECT and EXCEPT resolve every SELECT arm and record the union of every arm's data scope; output columns are matched by ordinal. If any arm cannot be followed, the whole statement raises a scope_unresolved objection rather than recording a partial scope. A set operation inside a WITH clause or derived table raises a scope_unresolved objection. It also follows projected aliases in GROUP BY, HAVING, and ORDER BY expressions, interval literals and {{name}} interval values, and date-part arguments declared by the datasource adapter (including MONTH and WEEK(MONDAY) where supported). String and comment boundaries follow the target datasource. Use an explicit PostgreSQL escape string when an ordinary backslash could change where a quote ends, and write Unicode identifier characters directly inside double quotes. A statement whose output lineage it cannot follow also counts every output as possibly sensitive for the glossary term-binding requirement, which refuses a call with term_binding_required once this Project holds any glossary term; bind each output's term through schema_bindings to clear it. A top-level set operation whose operator declares name matching (BY NAME, CORRESPONDING or STRICT CORRESPONDING), or carries an outer mode in front of its operator (FULL, LEFT, RIGHT or INNER), also counts every output as possibly sensitive for that requirement even when the whole statement resolves, because which column feeds each output cannot be followed; bind every output's term through schema_bindings, or write the operation positionally where the same column order is what the Request means.

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": {
      "name": "<name>",
      "description": "<description>"
    },
    "name": "suggest_approved_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlNoA statement request's text, with {{parameter}} placeholders. Required for request_kind "statement"; an operation request has none.
nameYesHuman-readable name for the query
tagsNoOptional tags for organizing queries (e.g., ["billing", "category:analytics", "reporting"])
moduleNoAn operation request's published module. Supplied together with operation and artifact_hash, and only for request_kind "operation".
operationNoThe operation inside the module that this query's text is. Supplied together with module and artifact_hash, and only for request_kind "operation".
parametersNoParameter definitions for {{placeholder}} values in SQL
descriptionYesWhat business question this query answers
request_kindNoWhat this query's text is: "statement" (the default) for a statement in the datasource's dialect, or "operation" for an operation of a module published to the Request Service. A statement request carries `sql` and nothing else; an operation request carries `module`, `operation` and `artifact_hash` and no statement.
artifact_hashNoThe lowercase hex SHA-256 of the module version this query is frozen against, from the published artifact. Supplied together with module and operation, and only for request_kind "operation".
datasource_idNoUUID of the datasource to validate against and bind the suggestion to (optional). Omit to use the project's configured default datasource; required when the project has multiple datasources and no default is configured. A datasource that has not finished setup is refused with datasource_not_ready.
application_idNoOptional Application UUID whose build this call serves (Administrator only). Setup steps this call opens record it, so they show on that Application's build screen; the resources themselves stay shared by the Project. A shared step it reuses keeps the Application it was opened for, so a step it returns may be watchable with get_setup_journal only without application_id. Use the build's application_id, the one you call describe_application with.
schema_bindingsNoBind existing output names and parameter names to schema columns in this datasource. Each value is namespace.entity:path. The term is resolved from that column's glossary binding, authored separately under schema-governance authority; this is the only way to attach a term to a Request, and an inline term never counts. Replaces all bindings; {} clears them. An address must name a column this datasource has — for an operation Request, one of the paths its publish declared — or this call refuses it. At approval every output that reaches sensitive data, and every output and parameter of a request tagged composable, must be bound here; a statement whose output lineage cannot be resolved counts every output as possibly sensitive, and so does a set operation that matches its arms by name or carries an outer mode, even when it resolves.
max_affected_rowsNoPositive cap for a modifying SQL statement or a declared connector operation. An operation cap must be between 1 and the manifest's declared max_affected. Omit for reads
output_column_descriptionsNoOptional descriptions for output columns (e.g., {"total_earned_usd": "Total earnings in USD"})

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / schema_bindings / description
      Previous value: -"Bind existing output names and parameter names to schema columns in this datasource. Each value is namespace.entity:path. The term is resolved from that column's glossary binding, authored separately under schema-governance authority; this is the only way to attach a term to a Request, and an inline term never counts. Replaces all bindings; {} clears them. An address must name a column this datasource has — for an operation Request, one of the paths its publish declared — or this call refuses it. At approval every output that reaches sensitive data, and every output and parameter of a request tagged composable, must be bound here; a statement whose output lineage cannot be resolved counts every output as possibly sensitive."New value: +"Bind existing output names and parameter names to schema columns in this datasource. Each value is namespace.entity:path. The term is resolved from that column's glossary binding, authored separately under schema-governance authority; this is the only way to attach a term to a Request, and an inline term never counts. Replaces all bindings; {} clears them. An address must name a column this datasource has — for an operation Request, one of the paths its publish declared — or this call refuses it. At approval every output that reaches sensitive data, and every output and parameter of a request tagged composable, must be bound here; a statement whose output lineage cannot be resolved counts every output as possibly sensitive, and so does a set operation that matches its arms by name or carries an outer mode, even when it resolves."
  2. Added

TDQS

A3.8/5.0
Behavior5/5

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

Annotations only say readOnlyHint=false, destructiveHint=false, idempotent=false, so the description carries real weight and delivers: the result is pending review, the response contains a browser approval URL, unresolvable scope raises a scope_unresolved objection (blocking in browser, non-blocking under MCP authority), and term_binding_required refusals are explained. This is behavior an agent cannot get from the annotations or schema.

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

Conciseness2/5

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

The bulk of the text is a parser specification (CTEs, set operations, interval literals, escape strings, Unicode identifiers) that does not help an agent decide to call the tool or fill its parameters. The one usage sentence is buried mid-paragraph rather than front-loaded, and key invocation facts are scattered through a dense block.

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

Completeness4/5

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

For a 14-parameter tool with nested objects and no output schema, the description covers outcome, approval URL, failure modes and the glossary binding requirement well. Gaps remain around ordinary validation errors and interactivity with sibling suggestion tools, but nothing essential to a correct call is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description earns more by explaining request_kind's two modes and the exact rule for parameters on operation requests ('omitting parameters carries the operation's declared parameters; a supplied list must include every parameter the operation requires'). It also ties schema_bindings to the glossary term-binding requirement, which the schema only partially conveys.

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

Purpose4/5

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

Opens with a specific verb and resource: 'Suggest a reusable parameterized query for approval', and clarifies the outcome ('stays pending for review, even when direct query management is enabled'), which meaningfully separates it from create_approved_query. It never names that sibling explicitly, so the differentiation is inferred from behavior rather than stated.

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

Usage Guidelines3/5

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

Contains one when-to-use sentence ('Use this when you discover a useful query pattern that should be saved for future use'), which is genuinely helpful. But it names no alternatives (create_approved_query, suggest_query_update) and gives no when-not-to-use condition or prerequisites, leaving the agent to guess when a direct creation path is preferable.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources