Skip to main content
Glama

api_spec_list

Lists all imported API specifications so you can see which APIs are available for testing.

Instructions

Lista todos los specs de API importados. Úsalo para descubrir qué APIs están disponibles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler for the 'api_spec_list' tool. Registered via server.tool() with an empty schema (no input parameters). Calls storage.listSpecs() and returns the list of imported API specs as JSON, or a message if none exist. Handles errors gracefully.
    server.tool(
      'api_spec_list',
      'Lista todos los specs de API importados. Úsalo para descubrir qué APIs están disponibles.',
      {},
      async () => {
        try {
          const items = await storage.listSpecs()
    
          if (items.length === 0) {
            return {
              content: [
                {
                  type: 'text' as const,
                  text: 'No hay specs importados. Usa api_import para importar uno.',
                },
              ],
            }
          }
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(items, null, 2),
              },
            ],
          }
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error)
          return {
            content: [{ type: 'text' as const, text: `Error: ${message}` }],
            isError: true,
          }
        }
      },
    )
  • Registration of the 'api_spec_list' tool on the MCP server via server.tool(). The function registerApiSpecTools (line 50) is called from src/server.ts (line 65) with the server and storage instances.
    server.tool(
      'api_spec_list',
      'Lista todos los specs de API importados. Úsalo para descubrir qué APIs están disponibles.',
      {},
      async () => {
        try {
          const items = await storage.listSpecs()
    
          if (items.length === 0) {
            return {
              content: [
                {
                  type: 'text' as const,
                  text: 'No hay specs importados. Usa api_import para importar uno.',
                },
              ],
            }
          }
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(items, null, 2),
              },
            ],
          }
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error)
          return {
            content: [{ type: 'text' as const, text: `Error: ${message}` }],
            isError: true,
          }
        }
      },
    )
  • The storage helper that powers the handler. listSpecs() reads all JSON files from the specs directory, parses each as an ApiSpec, and maps them to ApiSpecListItem objects containing name, source, endpointCount, and version.
    async listSpecs(): Promise<ApiSpecListItem[]> {
      await this.ensureDir('specs')
      const files = await this.listJsonFiles(this.specsDir)
    
      const allSpecs = await Promise.all(
        files.map((file) => this.readJson<ApiSpec>(join(this.specsDir, file))),
      )
    
      return allSpecs
        .filter((spec): spec is ApiSpec => spec !== null)
        .map((spec) => ({
          name: spec.name,
          source: spec.source,
          endpointCount: spec.endpoints.length,
          version: spec.version,
        }))
    }
  • The ApiSpecListItem interface defining the return shape: name (string), source (string), endpointCount (number), and optional version (string). This is the schema for items returned by api_spec_list.
    export interface ApiSpecListItem {
      name: string
      source: string
      endpointCount: number
      version?: string
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden but only states the action. It lacks details on response format, side effects (none expected), or any constraints beyond listing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two concise sentences, front-loaded with the core action and purpose. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple listing tool with no parameters, the description is mostly complete: it states what it lists and why. It could mention the output format (e.g., returns names) but is sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so baseline score is 4. The description adds no parameter info because none exist, and schema coverage is 100%.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists all imported API specs, using a specific verb and resource, and distinguishes it from sibling listing tools like env_list or collection_list.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use it to discover available APIs, providing clear context. However, it does not specify when not to use it or compare to alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/cocaxcode/api-testing-mcp'

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