Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number (default: 1)
page_sizeNoNumber of results per page (default: 25)

Implementation Reference

  • 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, }; } }, };
  • 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';
  • 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; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jasonsmithj/redash-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server