Skip to main content
Glama
mcgiverdev

MCP API Server

by mcgiverdev

listar-empresas

Retrieve all registered companies from the API to access business data for analysis, management, or integration purposes.

Instructions

Lista todas las empresas registradas en la API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'listar-empresas' tool. It fetches the list of companies using companyService.getCompanies(), formats them into a readable text list, handles empty results and errors, returning structured content.
    export async function listCompaniesToolHandler() {
      try {
        const companies = await companyService.getCompanies();
        
        if (companies.length === 0) {
          return {
            content: [
              {
                type: "text" as const,
                text: "No hay empresas registradas en el sistema."
              }
            ]
          };
        }
    
        const companiesList = companies.map(company => 
          `🏢 ${company.name}
       ID: ${company.id}
       Email: ${company.email}
       Teléfono: ${company.phone}
       Industria: ${company.industry}
       Tamaño: ${company.size}
       Creada: ${new Date(company.created_at).toLocaleString()}`
        ).join('\n\n');
    
        return {
          content: [
            {
              type: "text" as const,
              text: `Se encontraron ${companies.length} empresa(s):\n\n${companiesList}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: `❌ Error al obtener las empresas: ${error.message}`
            }
          ]
        };
      }
    }
  • Input schema for the 'listar-empresas' tool. It is an empty object, indicating no input parameters are required.
    /**
     * Esquema de entrada para listar empresas (sin parámetros requeridos)
     */
    export const listCompaniesInputSchema = {};
  • src/main.ts:62-69 (registration)
    Registration of the 'listar-empresas' tool with the MCP server, linking the name, description, input schema, and handler function.
    server.registerTool(
      "listar-empresas",
      {
        description: "Lista todas las empresas registradas en la API",
        inputSchema: listCompaniesInputSchema
      },
      listCompaniesToolHandler
    );
  • The getCompanies method in CompanyService, which makes an HTTP GET request to retrieve the list of companies from the external API. This is the core data-fetching helper used by the tool handler.
    async getCompanies(): Promise<CompanyListResponse> {
      try {
        const response = await httpClient.get<CompanyListResponse>(API_ENDPOINTS.companies);
        return response.data;
      } catch (error) {
        console.error('Error al obtener empresas:', error);
        throw new Error(`No se pudieron obtener las empresas: ${error.message}`);
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does ('list all registered companies'). It doesn't disclose behavioral traits like whether it's read-only, pagination behavior, rate limits, authentication needs, or what 'all' means (e.g., active only, includes archived). For a list operation with zero annotation coverage, this is inadequate.

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?

The description is a single, clear sentence with zero waste. It's appropriately sized for a simple list tool and front-loaded with the core action. Every word earns its place.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally complete but lacks context about behavior. It states what it does but not how it behaves (e.g., format, limitations). For a list tool with no structured fields, it should provide more operational context to be fully helpful.

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 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter information, which is appropriate. Baseline is 4 for zero parameters, as the schema fully covers the absence of inputs.

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

Purpose4/5

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

The description clearly states the verb ('Lista') and resource ('empresas registradas en la API'), making the purpose specific and understandable. It distinguishes from siblings like 'crear-empresa' (create) and 'listar-usuarios' (list users), but doesn't explicitly differentiate from 'obtener-clima' (get weather) since they're unrelated resources. A 5 would require explicit sibling differentiation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing, or compare with other tools like 'crear-empresa' for creating companies or 'listar-usuarios' for listing users. The agent must infer usage from the name and description alone.

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/mcgiverdev/mcp-api-v1'

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