Skip to main content
Glama

Save query

save_query
Destructive

Save SQL to the query library, or overwrite one of your own saved queries by passing its id. Use it when the user wants to keep, reuse or schedule a query; pass the returned id to run_saved_query or create_schedule. Does not run the SQL, so test it with execute_query first. A new query is private to you until shared in the app; on an approved_queries connection it is a draft that cannot run until a person shares it, and the SQL of a shared query there cannot be changed. Passing an id replaces that query's name, SQL, connection and folder; you can only update queries you created. Needs the write scope, plus execute to change the SQL of a scheduled query.

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>",
      "sql": "<sql>"
    },
    "name": "save_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoId of the saved query to overwrite. Omit to create a new one.
sqlYesThe SQL to save.
nameYesDisplay name in the query library.
folderPathNoSingle folder label to file it under; null or omitted for the root.
connectionIdNoConnection id from list_connections.

Output Schema

NameRequiredDescriptionDefault
idNo
sqlNo
nameNo
isSharedNo
updatedAtNo
variablesNoDeclared {{name}} variables, filled in by run_saved_query.
folderPathNo
connectionIdNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedOutput schema / properties / variables / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": true,
      -      "properties": {
      -        "name": {
      -          "type": [
      -            "string",
      -            "null"
      -          ]
      -        },
      -        "type": {
      -          "type": [
      -            "string",
      -            "null"
      -          ]
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "name": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "type": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations (readOnly=false, destructive=true), it discloses that a new query is private until shared, that on approved_queries connections the result is a non-runnable draft until a person shares it, that shared SQL is immutable there, that passing an id replaces name/SQL/connection/folder, and that only self-created queries can be updated. It also states scope requirements (write, plus execute to change SQL of a scheduled query), which is exactly the permission context the annotations cannot carry.

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 core verb and resource, then layered behavior, alternatives and permissions; every sentence carries information. The second half is a dense run-on chain of clauses that could be split for scannability, but no content is filler.

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?

For a destructive mutation with five parameters and an output schema, this covers the mutation risks, sharing/draft states, permission requirements and the downstream handoff of the returned id. Return-value shape is the only omission, and an output schema already supplies that.

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 a baseline of 3 applies, but the description adds real meaning on top: id is an overwrite selector that replaces name, SQL, connection and folder, and the returned id is the input to run_saved_query/create_schedule. It does not re-explain folderPath or how connectionId affects the draft/sharing rules, leaving some cross-field interaction implicit.

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?

States a specific verb and resource (save SQL to the query library) plus the overwrite variant keyed on id, and explicitly names the sibling tools it works with (run_saved_query, create_schedule, execute_query). An agent can distinguish it from execute_query and run_saved_query without opening any 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?

Gives explicit when-to-use triggers (keep, reuse or schedule a query), names the downstream alternatives for each intent, and adds an exclusion-with-remedy: it does not run SQL, so test with execute_query first. Nothing about tool selection is left to inference.

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