Skip to main content
Glama
by OpaqueGlass
mcpResponse.ts910 B
import { array } from "zod"; /** * Success response helper */ export function createSuccessResponse(text: string, metadata?: Record<string, any>): McpResponse { return { content: [{ type: "text", text }], _meta: metadata }; } /** * JSON response helper */ export function createJsonResponse(data: any, otherData: any[]|null=null): McpResponse { if (Array.isArray(data)) { data = { result: data }; } const result: McpContent[] = [{ type: "text", text: JSON.stringify(data, null, 2) } as McpContent]; if (otherData != null) { result.push(...otherData as McpContent[]); } return { content: result, structuredContent: data, }; } /** * Error response helper */ export function createErrorResponse(errorMessage: string): McpResponse { return { content: [{ type: "text", text: errorMessage }], isError: true }; }

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/OpaqueGlass/syplugin-anMCPServer'

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