Skip to main content
Glama

Coupler Analytics

by railsware
handler.ts1.6 kB
import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js' import { readFileSync } from 'fs' import { fromError } from 'zod-validation-error' import { textResponse } from '../../util/tool-response.js' import { FileManager } from '../shared/file-manager.js' import { logger } from '../../logger/index.js' import { zodSchema } from './schema.js' type ColumnDefinition = { key: string, columnName?: string, label: string, schema: { type: string }, typeOptions?: Record<string, unknown>, } export const handler = async (params?: Record<string, unknown>): Promise<CallToolResult> => { const validationResult = zodSchema.safeParse(params) if (!validationResult.success) { const error = fromError(validationResult.error) logger.error(`Invalid parameters for get-schema tool: ${error.toString()}`) return textResponse({ text: `Invalid parameters for get-schema tool. ${error.toString()}`, isError: true, }) } const fileManager = new FileManager(validationResult.data) let schemaPath: string try { schemaPath = await fileManager.getFile('schema') } catch (e) { logger.error(`Failed to get dataflow schema file: ${e}`) return textResponse({ text: `Failed to get dataflow ${validationResult.data.dataflowId} schema file. ${e}`, isError: true }) } const schema = JSON.parse(readFileSync(schemaPath, 'utf-8')) schema.columns.forEach((col: ColumnDefinition, index: number) => { col.columnName = `col_${index}` }) return textResponse({ text: JSON.stringify(schema, null, 2), structuredContent: { schema } }) }

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/railsware/coupler-io-mcp-server'

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