Suggest a Request for approval
suggest_approved_querySuggest 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
| Name | Required | Description | Default |
|---|---|---|---|
| sql | No | A statement request's text, with {{parameter}} placeholders. Required for request_kind "statement"; an operation request has none. | |
| name | Yes | Human-readable name for the query | |
| tags | No | Optional tags for organizing queries (e.g., ["billing", "category:analytics", "reporting"]) | |
| module | No | An operation request's published module. Supplied together with operation and artifact_hash, and only for request_kind "operation". | |
| operation | No | The operation inside the module that this query's text is. Supplied together with module and artifact_hash, and only for request_kind "operation". | |
| parameters | No | Parameter definitions for {{placeholder}} values in SQL | |
| description | Yes | What business question this query answers | |
| request_kind | No | What 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_hash | No | The 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_id | No | UUID 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_id | No | Optional 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_bindings | No | 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. | |
| max_affected_rows | No | Positive 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_descriptions | No | Optional descriptions for output columns (e.g., {"total_earned_usd": "Total earnings in USD"}) |