Skip to main content
Glama
response-formatter.ts661 B
/** * Response formatting utilities for MCP tools */ /** * Create a successful tool response */ export function createToolSuccessResponse(data: any) { return { content: [ { type: "text" as const, text: JSON.stringify(data, null, 2), }, ], }; } /** * Create an error tool response */ export function createToolErrorResponse(message: string, code?: string) { const errorData: any = { error: message, }; if (code) { errorData.code = code; } return { content: [ { type: "text" as const, text: JSON.stringify(errorData, null, 2), }, ], 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/zq940222/OssHub'

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