list_queries
Retrieve and display all queries stored in Redash for review and management, with pagination support for large datasets.
Instructions
List all queries in Redash
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_queries"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default: 1) | |
| page_size | No | Number of results per page (default: 25) |
Implementation Reference
- src/tools/query.ts:97-144 (handler)Complete implementation of the 'list_queries' tool, including name, description, input schema, and handler function that paginates and fetches queries via Redash client.
export const listQueriesTool: Tool = { name: 'list_queries', description: 'List all queries in Redash', inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number (default: 1)', minimum: 1, }, page_size: { type: 'number', description: 'Number of results per page (default: 25)', minimum: 1, maximum: 100, }, }, additionalProperties: false, }, handler: async (args, client) => { try { const page = typeof args.page === 'number' ? args.page : 1; const pageSize = typeof args.page_size === 'number' ? args.page_size : 25; const queries = await client.listQueries(page, pageSize); return { content: [ { type: 'text', text: JSON.stringify(queries, null, 2), } as TextContent, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error listing queries: ${error instanceof Error ? error.message : String(error)}`, } as TextContent, ], isError: true, }; } }, }; - src/tools/query.ts:100-116 (schema)Input schema defining optional pagination parameters for the list_queries tool.
inputSchema: { type: 'object', properties: { page: { type: 'number', description: 'Page number (default: 1)', minimum: 1, }, page_size: { type: 'number', description: 'Number of results per page (default: 25)', minimum: 1, maximum: 100, }, }, additionalProperties: false, }, - src/index.ts:59-59 (registration)Registration of listQueriesTool in the main tools array used by MCP server handlers.
const tools = [listDataSourcesTool, getDataSourceTool, executeQueryAndWaitTool, listQueriesTool]; - src/index.ts:17-17 (registration)Import of listQueriesTool into the main index file.
import { executeQueryAndWaitTool, listQueriesTool } from './tools/query.js'; - src/redash-client.ts:204-209 (helper)RedashClient method that performs the API request to list queries, used by the tool handler.
async listQueries(page = 1, pageSize = 25): Promise<Query[]> { const response = await this.request<{ results: Query[] }>( `/api/queries?page=${page}&page_size=${pageSize}` ); return response.results; }