Skip to main content
Glama
suthio

Redash MCP Server

by suthio

create_visualization

Creates a new visualization for a given query, enabling visual representation of query results with configurable types and options.

Instructions

Create a new visualization for a query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
query_idYesID of the query to create visualization for
typeYesType of visualization. Available types depend on your Redash instance. Use get_query to see existing visualization types in use.
nameYesName of the visualization
descriptionNoDescription of the visualization
optionsYesVisualization-specific configuration. The structure depends on your Redash instance and visualization type. Use get_visualization to examine existing visualizations of the same type as a reference.

Implementation Reference

  • Handler function for create_visualization tool. Validates inputs via Zod schema, constructs a CreateVisualizationRequest, calls redashClient.createVisualization(), and returns the result.
    async function createVisualization(params: z.infer<typeof createVisualizationSchema>) {
      try {
        const visualizationData: CreateVisualizationRequest = {
          query_id: params.query_id,
          type: params.type,
          name: params.name,
          description: params.description,
          options: params.options
        };
    
        const result = await redashClient.createVisualization(visualizationData);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2)
            }
          ]
        };
      } catch (error) {
        console.error('Error creating visualization:', error);
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error creating visualization: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Zod schema defining input validation for create_visualization: requires query_id (number), type (string), name (string), options (any), optional description (string).
    const createVisualizationSchema = z.object({
      query_id: z.coerce.number(),
      type: z.string(),
      name: z.string(),
      description: z.string().optional(),
      options: z.any()
    });
  • src/index.ts:1769-1782 (registration)
    Registration of the 'create_visualization' tool in the ListToolsRequestSchema handler, defining its name, description, and inputSchema.
      name: "create_visualization",
      description: "Create a new visualization for a query",
      inputSchema: {
        type: "object",
        properties: {
          query_id: { type: "number", description: "ID of the query to create visualization for" },
          type: { type: "string", description: "Type of visualization. Available types depend on your Redash instance. Use get_query to see existing visualization types in use." },
          name: { type: "string", description: "Name of the visualization" },
          description: { type: "string", description: "Description of the visualization" },
          options: { type: "object", description: "Visualization-specific configuration. The structure depends on your Redash instance and visualization type. Use get_visualization to examine existing visualizations of the same type as a reference." }
        },
        required: ["query_id", "type", "name", "options"]
      }
    },
  • The redashClient.createVisualization() helper function that makes the actual POST request to '/api/visualizations' to create a new visualization.
    async createVisualization(data: CreateVisualizationRequest): Promise<RedashVisualization> {
      try {
        const response = await this.client.post('/api/visualizations', data);
        return response.data;
      } catch (error) {
        console.error('Error creating visualization:', error);
        throw new Error('Failed to create visualization');
      }
    }
  • TypeScript interface CreateVisualizationRequest defining the data structure accepted by the API client.
    export interface CreateVisualizationRequest {
      query_id: number;
      type: string;
      name: string;
      description?: string;
      options: any;
    }
Behavior2/5

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

No annotations exist, and the description only states the action without disclosing important behaviors like authentication requirements, side effects, or error states. Minimal transparency.

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

Conciseness4/5

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

The description is a single concise sentence, but it could benefit from additional context without becoming verbose. Efficient but slightly under-informative.

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 is provided, and the description omits details about return values, constraints, or dependencies (e.g., query existence). Incomplete for a creation tool with nested parameters.

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 coverage is 100%, so parameters are already documented. The description adds no additional meaning beyond the schema, meeting the baseline of 3.

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?

The description 'Create a new visualization for a query' uses a specific verb ('create') and resource ('visualization for a query'), clearly distinguishing it from siblings like 'create_query' or 'create_alert'.

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 is provided on when to use this tool versus alternatives (e.g., update_visualization) or prerequisites (e.g., query must exist). Lacks any context for appropriate usage.

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