Skip to main content
Glama

Hive MCP Server

response.ts1.62 kB
// Utilities for formatting consistent responses import { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol'; // Update the Response interface to include index signature export interface SuccessResponse { [key: string]: unknown; content: { type: 'text'; text: string; mimeType?: string; }[]; isError?: false; } export interface ErrorResponse { [key: string]: unknown; content: { type: 'text'; text: string; mimeType?: string; }[]; isError: true; } export type Response = SuccessResponse | ErrorResponse; // Create a successful JSON response export function successJson(data: unknown): Response { return { content: [ { type: 'text', text: JSON.stringify(data, null, 2), mimeType: 'application/json', }, ], }; } // Create a successful text response export function successText(text: string): Response { return { content: [ { type: 'text', text, }, ], }; } // Create an error response export function errorResponse(message: string): Response { return { content: [ { type: 'text', text: message, }, ], isError: true, }; } // Wrapper to adapt tool handlers to MCP SDK format export function adaptHandler<T>( handler: (params: T) => Promise<Response> ): (params: T, extra: RequestHandlerExtra) => Promise<Response> { return async (params: T, extra: RequestHandlerExtra): Promise<Response> => { return await handler(params); }; } export default { successJson, successText, errorResponse, adaptHandler, };

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/gluneau/hive-mcp-server'

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