Skip to main content
Glama

get_data_source

Retrieve configuration details and metadata for a specific data source by providing its unique identifier to manage database connections and query settings.

Instructions

Get details about a specific data source

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_source_idYesThe ID of the data source

Implementation Reference

  • The async handler function that executes the get_data_source tool logic: validates data_source_id, fetches the data source via RedashClient, stringifies to JSON, or returns error.
    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 data_source_id as a required 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:59-59 (registration)
    Registration of getDataSourceTool in the tools array used by the MCP server's list_tools and call_tool request handlers.
    const tools = [listDataSourcesTool, getDataSourceTool, executeQueryAndWaitTool, listQueriesTool];
  • Helper method in RedashClient that performs the API request to retrieve 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}`); }

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