# run_query

Source: https://dropshelf.ai/docs/reference/mcp/tools/connectors/run_query

Try a query before putting it in a drop's _dropshelf/queries.yaml.

On a database: one SELECT, checked as a deploy checks a drop's queries (your scope, a view's tables only through the view, read only, no denied functions), never cached, at most 100 rows; viewer parameters (:viewer_email and the like) are your own. On an MCP server: one tool the source allows, with its args, called once with your own connection; the answer's result is what the tool returned.

**Read-only**

Needs `connectors.enabled` on the instance.

## Input [#input]

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `args` | object | no | the tool's arguments, as its input schema in describe_source names them |
| `params` | object | no | values for the :name placeholders, as strings |
| `source` | string | yes | the source's name, as list_sources gives it |
| `sql` | string | no | for a database: one SELECT in the source's dialect; :name placeholders take values from params |
| `tool` | string | no | for an MCP server: one of the tools the source allows, as describe_source lists them |

## Output [#output]

| Field | Type | Always present | Description |
| --- | --- | --- | --- |
| `columns` | array of object | no |  |
| `columns[].name` | string | yes |  |
| `columns[].type` | string | yes |  |
| `fetchedAt` | string | yes | When it was read. |
| `result` | string or number or boolean or object or array of any, nullable | no | for a tool call on an MCP server: what the tool returned |
| `rows` | array of array of string or number or boolean or object or array of any, nullable | no |  |

<details>
<summary>The output as JSON Schema</summary>

```json
{
  "properties": {
    "columns": {
      "items": {
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "type"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "fetchedAt": {
      "description": "When it was read.",
      "format": "date-time",
      "type": "string"
    },
    "result": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "object"
        },
        {
          "type": "array"
        }
      ],
      "description": "for a tool call on an MCP server: what the tool returned"
    },
    "rows": {
      "items": {
        "items": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            },
            {
              "type": "object"
            },
            {
              "type": "array"
            }
          ],
          "description": "a cell: text, a number, true or false, null, or a json column's value"
        },
        "type": "array"
      },
      "type": "array"
    }
  },
  "required": [
    "fetchedAt"
  ],
  "type": "object"
}
```

</details>

Generated from dropshelf core at `6a548b2`, 26 Nov 2026.
