Skip to main content
Glama
utils.ts700 B
import { Tool } from '@modelcontextprotocol/sdk/types.js'; import toJsonSchema from 'to-json-schema'; /** * Utility function to convert tool names (replace hyphens with underscores) */ export function convertToolName(input: string): string { return input.replace(/-/g, "_"); } /** * Converts MCP tool output to a JSON Schema outputSchema format * @param output - The raw output from an MCP tool * @returns A JSON Schema object describing the output structure */ export function convertOutputToSchema(output: any): Tool["outputSchema"] | undefined { // Use to-json-schema to generate schema from the output const schema = toJsonSchema(output); return schema as Tool["outputSchema"]; }

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/eliavamar/mcp-of-mcps'

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