Skip to main content
Glama
suthio

Redash MCP Server

by suthio

fork_query

Create a copy of an existing Redash query by specifying its ID. This allows you to modify the duplicate without altering the original.

Instructions

Fork (duplicate) an existing query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryIdYesID of the query to fork

Implementation Reference

  • MCP tool handler function for fork_query - receives queryId, calls redashClient.forkQuery(), and returns result as JSON text content.
    async function forkQuery(params: z.infer<typeof forkQuerySchema>) {
      try {
        const result = await redashClient.forkQuery(params.queryId);
        return {
          content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
        };
      } catch (error) {
        logger.error(`Error forking query ${params.queryId}: ${error}`);
        return {
          isError: true,
          content: [{ type: "text", text: `Error forking query ${params.queryId}: ${error instanceof Error ? error.message : String(error)}` }]
        };
      }
    }
  • Zod validation schema for fork_query - expects a single numeric queryId parameter.
    const forkQuerySchema = z.object({
      queryId: z.coerce.number()
    });
  • src/index.ts:2087-2097 (registration)
    MCP tool registration listing fork_query in the tools array returned by ListToolsRequestSchema handler.
    {
      name: "fork_query",
      description: "Fork (duplicate) an existing query",
      inputSchema: {
        type: "object",
        properties: {
          queryId: { type: "number", description: "ID of the query to fork" }
        },
        required: ["queryId"]
      }
    },
  • src/index.ts:2484-2486 (registration)
    CallToolRequestSchema switch-case dispatching to forkQuery handler when tool name is 'fork_query'.
    case "fork_query":
      logger.debug(`Handling fork_query`);
      return await forkQuery(forkQuerySchema.parse(args));
  • RedashClient.forkQuery helper method - makes POST request to /api/queries/{queryId}/fork to fork a query via the Redash API.
    async forkQuery(queryId: number): Promise<RedashQuery> {
      try {
        const response = await this.client.post(`/api/queries/${queryId}/fork`);
        return response.data;
      } catch (error) {
        logger.error(`Error forking query ${queryId}: ${error}`);
        throw new Error(`Failed to fork query ${queryId}: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, description must cover behavioral traits. Only states 'Fork (duplicate) an existing query' without explaining what duplication entails (e.g., copying visualizations, permissions, dependencies).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with parenthetical clarification. No unnecessary verbiage; front-loaded action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema, no annotations, and sparse description. Lacks details on side effects, required permissions, or behavior on failure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description already provides 'ID of the query to fork'. Tool description does not add new semantic meaning beyond schema; baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Answering specifically verb+resource: 'Fork (duplicate)' clearly indicates the action, and 'an existing query' specifies the resource. This distinguishes from siblings like 'create_query' (new query) and 'fork_dashboard' (different resource).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'create_query' or 'execute_query'. Does not mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/suthio/redash-mcp'

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