Skip to main content
Glama
jasonsmithj

Redash MCP Server

by jasonsmithj

get_data_source

Retrieve configuration and connection details for a specific data source in Redash by providing its ID.

Instructions

Get details about a specific data source

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_source_idYesThe ID of the data source

Implementation Reference

  • The handler function that implements the core logic of the 'get_data_source' tool: validates the data_source_id argument, fetches the data source using RedashClient, stringifies it to JSON, or returns an error response.
    handler: async (args, client) => {
      try {
        const dataSourceId = args.data_source_id;
    
        if (typeof dataSourceId !== 'number') {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: data_source_id is required and must be a number',
              } as TextContent,
            ],
            isError: true,
          };
        }
    
        const dataSource = await client.getDataSource(dataSourceId);
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(dataSource, null, 2),
            } as TextContent,
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `Error getting data source: ${error instanceof Error ? error.message : String(error)}`,
            } as TextContent,
          ],
          isError: true,
        };
      }
    },
  • Input schema definition for the 'get_data_source' tool, specifying the required 'data_source_id' as a number >=1.
    inputSchema: {
      type: 'object',
      properties: {
        data_source_id: {
          type: 'number',
          description: 'The ID of the data source',
          minimum: 1,
        },
      },
      required: ['data_source_id'],
      additionalProperties: false,
    },
  • src/index.ts:56-59 (registration)
    Registration of the getDataSourceTool in the tools array used by the MCP server's list_tools and call_tool request handlers.
    /**
     * Register tools
     */
    const tools = [listDataSourcesTool, getDataSourceTool, executeQueryAndWaitTool, listQueriesTool];
  • Helper method in RedashClient that performs the API request to fetch a specific data source by ID, used by the tool handler.
     */
    async getDataSource(id: number): Promise<DataSource> {
      return this.request<DataSource>(`/api/data_sources/${id}`);
    }
    
    /**
Behavior2/5

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

With no annotations, the description carries full burden but only states it 'gets details', implying a read operation. It lacks behavioral context such as authentication needs, rate limits, error handling, or what 'details' include (e.g., metadata, status). This is inadequate for a tool with no annotation coverage.

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?

The description is a single, efficient sentence with zero waste. It's front-loaded and appropriately sized for a simple tool, making it easy to parse without unnecessary elaboration.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'details' are returned, error conditions, or how it fits with sibling tools. For a tool with minimal structured data, more context is needed to guide effective use.

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 the schema fully documents the single parameter 'data_source_id'. The description adds no additional meaning beyond implying it retrieves details for a specific source, aligning with the schema but not enhancing it. Baseline 3 is appropriate as the schema handles parameter documentation.

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 verb 'Get' and the resource 'details about a specific data source', making the purpose understandable. However, it doesn't differentiate from sibling tools like 'list_data_sources' beyond the singular vs. plural distinction, missing explicit contrast in scope or function.

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. It doesn't mention prerequisites like needing a data source ID, contrast with 'list_data_sources' for multiple sources, or relate to other siblings like 'execute_query_and_wait' for querying data.

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

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