Back to home
Connect a client

Run a read-only SQL query

Run a bounded query against PostgreSQL. The database enforces a read-only transaction; writes, including writes through functions, are rejected.

Arguments

NameTypeRequiredLimits
querystringYesAt least 1 character(s)
paramsJSON[]NoSee schema
projectIdstringYesAt least 1 character(s)
databaseIdstringYesAt least 1 character(s)
Full input schema
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1
    },
    "params": {
      "type": "array",
      "items": {}
    },
    "projectId": {
      "type": "string",
      "minLength": 1
    },
    "databaseId": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "projectId",
    "databaseId",
    "query"
  ],
  "additionalProperties": false
}

Example call

The params of a tools/call request. Replace the placeholder values with your own IDs.

{
  "name": "queryDatabase",
  "arguments": {
    "projectId": "REPLACE_WITH_PROJECT_ID",
    "databaseId": "REPLACE_WITH_DATABASE_ID",
    "query": "SELECT 1 AS result"
  }
}

Result

The same data as the API operation, wrapped as {"untrusted_data": true, "source": "queryDatabase", "note": "...", "data": ...} so the model treats project content as data, not instructions.