Skip to main content
Glama
suthio

Redash MCP Server

by suthio

get_schema

Retrieve the schema of a data source by providing its ID. Understand the structure of tables and columns in Redash.

Instructions

Get schema of a specific data source

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataSourceIdYesID of the data source to get schema

Implementation Reference

  • The main handler function for the 'get_schema' tool. It takes validated params (dataSourceId), calls redashClient.getSchema(), and returns the schema as JSON text content.
    async function getSchema(params: z.infer<typeof getSchemaSchema>) {
      try {
        const { dataSourceId } = params;
        const query = await redashClient.getSchema(dataSourceId);
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(query, null, 2),
            },
          ],
        };
      } catch (error) {
        logger.error(
          `Error getting data source ${params.dataSourceId} schema: ${error}`
        );
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error getting data source ${params.dataSourceId} schema: ${
                error instanceof Error ? error.message : String(error)
              }`,
            },
          ],
        };
      }
    }
  • Zod schema for validating the 'get_schema' tool input. Requires a 'dataSourceId' (coerced number).
    const getSchemaSchema = z.object({
      dataSourceId: z.coerce.number(),
    });
  • src/index.ts:1809-1822 (registration)
    Registration entry for the 'get_schema' tool in the ListToolsRequestSchema handler. Defines the tool name, description, and inputSchema (JSON Schema) for the MCP tool list.
    {
      name: "get_schema",
      description: "Get schema of a specific data source",
      inputSchema: {
        type: "object",
        properties: {
          dataSourceId: {
            type: "number",
            description: "ID of the data source to get schema",
          },
        },
        required: ["dataSourceId"],
      },
    },
  • src/index.ts:2393-2395 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes 'get_schema' requests to the getSchema handler function with schema validation.
    case "get_schema":
      logger.debug(`Handling get_schema`);
      return await getSchema(getSchemaSchema.parse(args));
  • Helper method on the RedashClient class that makes the actual HTTP GET request to Redash's /api/data_sources/{id}/schema endpoint and returns the schema data.
    // Get a specific data source schema by data source ID
    async getSchema(dataSourceId: number): Promise<RedashSchema> {
      try {
        const response = await this.client.get(
          `/api/data_sources/${dataSourceId}/schema`
        );
        return response.data;
      } catch (error) {
        console.error(
          `Error fetching data source ${dataSourceId} schema:`,
          error
        );
        throw new Error(
          `Failed to fetch data source ${dataSourceId} schema from Redash`
        );
      }
    }
Behavior2/5

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

With no annotations, the description carries the full burden of disclosure. It only states that the tool retrieves schema (a read operation) but provides no details on response format, required permissions, or side effects. This is insufficient for a tool with no annotation support.

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 that conveys the core purpose without redundancy. It is front-loaded but could benefit from slightly more detail without sacrificing brevity.

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?

Given the tool's simplicity (1 param, no output schema, no annotations), the description is too minimal. It does not explain what the schema output contains, which is critical for an agent to interpret the result correctly.

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?

The single parameter 'dataSourceId' is fully described in the input schema (100% coverage). The description adds no additional meaning beyond mapping the parameter to 'specific data source'. Since schema coverage is high, a baseline of 3 is appropriate.

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

Purpose4/5

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

The description clearly states the action ('Get') and the resource ('schema of a specific data source'), which distinguishes it from sibling tools like get_dashboard or list_data_sources. However, it does not elaborate on what the schema entails (e.g., tables, columns), leaving some ambiguity.

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, when not to use it, or alternatives. The description does not differentiate its use case from related tools like list_data_sources or get_query.

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