Skip to main content
Glama

get_spec_info

Retrieve OpenAPI specification details including title, version, description, servers, security schemes, and tagged endpoint counts to understand API structure and capabilities.

Instructions

Get general information about the OpenAPI spec: title, version, description, servers, security schemes, and available tags with endpoint counts. Start here to understand an unfamiliar API. Then use list_endpoints_by_tag or search_endpoints to explore specific areas.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the get_spec_info tool logic. It extracts and returns general information about the OpenAPI spec including title, version, description, servers, tags with endpoint counts, and security schemes.
    export function getSpecInfo(spec: ParsedSpec) {
      const result: Record<string, unknown> = {
        title: spec.info.title,
        version: spec.info.version,
        description: spec.info.description,
        servers: spec.info.servers,
        tags: spec.tags.map(t => ({
          name: t.name,
          description: t.description,
          endpointCount: t.endpointCount,
        })),
      }
    
      if (spec.info.securitySchemes.length > 0) {
        result.securitySchemes = spec.info.securitySchemes
      }
    
      if (spec.info.security.length > 0) {
        result.security = spec.info.security
      }
    
      return result
    }
  • src/index.ts:86-95 (registration)
    Registration of the get_spec_info tool with the MCP server. Defines the tool name, description, and handler callback that invokes getSpecInfo and returns the JSON-formatted result.
    server.registerTool(
      'get_spec_info',
      {
        description: 'Get general information about the OpenAPI spec: title, version, description, servers, security schemes, and available tags with endpoint counts. Start here to understand an unfamiliar API. Then use list_endpoints_by_tag or search_endpoints to explore specific areas.',
      },
      () => {
        const result = getSpecInfo(spec)
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }
      },
    )
  • Type definition for ParsedSpec, which is the input parameter type for the getSpecInfo handler function.
    export interface ParsedSpec {
      info: SpecInfo
      tags: TagInfo[]
      endpointIndex: EndpointEntry[]
      schemas: Record<string, unknown>
      rawSpec: OpenAPIObject
    }
  • Type definition for SpecInfo, which contains the core spec metadata that getSpecInfo extracts and returns.
    export interface SpecInfo {
      title: string
      version: string
      description: string
      servers: string[]
      security: Record<string, string[]>[]
      securitySchemes: SecuritySchemeInfo[]
    }
  • Type definition for TagInfo, which represents tag information returned by getSpecInfo with endpoint counts.
    export interface TagInfo {
      name: string
      description: string
      endpointCount: number
    }

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/ycs77/apifable'

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