Skip to main content
Glama
index.ts1.24 kB
// Cache for storing schemas export const schemaCache = new Map<string, { schema: any; timestamp: number }>() // Helper function to detect operation type export function detectOperationType(query: string): string { const normalizedQuery = query.trim().toLowerCase() // Remove comments const withoutComments = normalizedQuery.replace(/#.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '') // Check for operation type keywords if (withoutComments.match(/^\s*query\b/) || withoutComments.match(/^\s*{\s*\w+/)) { return "query" } else if (withoutComments.match(/^\s*mutation\b/)) { return "mutation" } else if (withoutComments.match(/^\s*subscription\b/)) { return "subscription" } return "query" // Default to query } // Helper to mask sensitive headers export function maskSensitiveHeaders(headers: Record<string, string> = {}): Record<string, string> { return Object.keys(headers).reduce((acc, key) => { // Mask sensitive headers if (key.toLowerCase().includes('authorization') || key.toLowerCase().includes('token') || key.toLowerCase().includes('key')) { acc[key] = '[REDACTED]' } else { acc[key] = headers[key] } return acc }, {} as Record<string, string>) }

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/matiasngf/mcp-fetch'

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