Skip to main content
Glama
jsonFormatting.ts493 B
/** * JSON formatting utility for MCP responses */ import { config } from '../config.js'; /** * Formats a value as JSON string for MCP responses. * Uses compact format by default, pretty-printed when LOG_LEVEL=debug. * * @param data - The data to format as JSON * @returns JSON string (compact or pretty-printed based on LOG_LEVEL) */ export function formatJson(data: unknown): string { return config.LOG_LEVEL === 'debug' ? JSON.stringify(data, null, 2) : JSON.stringify(data); }

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/jerichosequitin/Metabase'

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