Skip to main content
Glama

CTS MCP Server

by EricA1019
render_artifact.jsโ€ข2.58 kB
/** * CTS Render Artifact Tool * Renders artifacts using the ArtifactEngine */ import { z } from 'zod'; import { validateToolResponse } from '../schemas.js'; import { Errors } from '../errors.js'; const RenderArtifactParamsSchema = z.object({ artifactType: z.enum(['signal_map', 'hop_dashboard']), data: z.unknown(), metadata: z.object({ title: z.string().optional(), description: z.string().optional(), }).optional(), }); /** * Create tool handler with ArtifactEngine instance */ export function createRenderArtifactHandler(engine) { return async (args) => { const params = RenderArtifactParamsSchema.parse(args); const result = await engine.renderArtifact(params.artifactType, params.data, params.metadata); const response = { success: true, timestamp: new Date().toISOString(), toolName: 'CTS_Render_Artifact', result: { html: result.html, artifactType: params.artifactType, renderer: result.metadata.type, // Use metadata.type as renderer identifier }, }; // Validate response schema const { valid, errors } = validateToolResponse('CTS_Render_Artifact', response); if (!valid) { throw Errors.validationError('response', 'RenderArtifactResponse', errors?.errors[0]?.message || 'Invalid response structure'); } return response; }; } /** * Tool definition for CTS_Render_Artifact */ export const renderArtifactTool = { name: 'CTS_Render_Artifact', description: 'Render CTS artifacts (signal maps, hop dashboards) as HTML for display in VS Code webview or browser', inputSchema: { type: 'object', properties: { artifactType: { type: 'string', description: 'Type of artifact to render', enum: ['signal_map', 'hop_dashboard'], }, data: { type: 'object', description: 'Artifact data to render (structure varies by type)', }, metadata: { type: 'object', description: 'Optional metadata for artifact', properties: { title: { type: 'string', description: 'Artifact title' }, description: { type: 'string', description: 'Artifact description' }, }, }, }, required: ['artifactType', 'data'], }, }; //# sourceMappingURL=render_artifact.js.map

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/EricA1019/CTS_MCP'

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