Skip to main content
Glama
get-schema.ts1.1 kB
import { z } from "zod"; import { getParsedOpenAPI } from "../parser.js"; export const getSchemaTool = { name: "get_schema", config: { title: "Get Schema", description: "Get the full definition of a specific schema from components/schemas. Use list_schemas first to see available schema names.", inputSchema: { name: z.string().describe("The schema name to retrieve"), }, }, handler: async ({ name }: { name: string }) => { const parsed = getParsedOpenAPI(); const schema = parsed.schemas.get(name); if (!schema) { const availableSchemas = Array.from(parsed.schemas.keys()).slice(0, 10); return { content: [ { type: "text" as const, text: `Schema "${name}" not found. Available schemas: ${availableSchemas.join(", ")}${parsed.schemas.size > 10 ? "..." : ""}. Use list_schemas to see all.`, }, ], }; } return { content: [ { type: "text" as const, text: JSON.stringify({ name, schema }, null, 2), }, ], }; }, };

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/teddy258/opa-mcp'

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