Skip to main content
Glama
responseFormatter.ts764 B
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; export const formatSuccess = <T>(data: T): CallToolResult => { return { success: true, content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; }; export const formatVideoMap = <T>( videoIds: string[], results: T[] ): Record<string, T> => { return videoIds.reduce( (acc, videoId, index) => { acc[videoId] = results[index]; return acc; }, {} as Record<string, T> ); }; export const formatChannelMap = <T>( channelIds: string[], results: T[] ): Record<string, T> => { return channelIds.reduce( (acc, channelId, index) => { acc[channelId] = results[index]; return acc; }, {} as Record<string, T> ); };

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/kirbah/mcp-youtube'

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