get_query
Retrieve detailed information about a specific query by providing its ID. Ideal for query management and troubleshooting.
Instructions
Get details of a specific query
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| queryId | Yes | ID of the query to get |
Implementation Reference
- src/index.ts:1617-1627 (registration)Tool 'get_query' is registered with the MCP ListToolsRequestSchema, defining its name, description, and input schema (queryId number required).
{ name: "get_query", description: "Get details of a specific query", inputSchema: { type: "object", properties: { queryId: { type: "number", description: "ID of the query to get" } }, required: ["queryId"] } }, - src/index.ts:39-41 (schema)Zod schema for get_query validation: accepts queryId as a coerced number.
const getQuerySchema = z.object({ queryId: z.coerce.number() }); - src/index.ts:43-68 (handler)Handler function for get_query. Calls redashClient.getQuery(queryId) and returns the JSON-stringified result, or an error message on failure.
async function getQuery(params: z.infer<typeof getQuerySchema>) { try { const { queryId } = params; const query = await redashClient.getQuery(queryId); return { content: [ { type: "text", text: JSON.stringify(query, null, 2) } ] }; } catch (error) { logger.error(`Error getting query ${params.queryId}: ${error}`); return { isError: true, content: [ { type: "text", text: `Error getting query ${params.queryId}: ${error instanceof Error ? error.message : String(error)}` } ] }; } } - src/index.ts:2342-2344 (registration)Dispatch case in CallToolRequestSchema handler that routes 'get_query' tool calls to the getQuery function with schema validation.
case "get_query": logger.debug(`Handling get_query`); return await getQuery(getQuerySchema.parse(args)); - src/redashClient.ts:356-364 (helper)RedashClient.getQuery() - makes an HTTP GET to /api/queries/{queryId} and returns the RedashQuery data. This is the underlying API client helper.
async getQuery(queryId: number): Promise<RedashQuery> { try { const response = await this.client.get(`/api/queries/${queryId}`); return response.data; } catch (error) { console.error(`Error fetching query ${queryId}:`, error); throw new Error(`Failed to fetch query ${queryId} from Redash`); } }