Skip to main content
Glama

listar-empresas

Retrieve a comprehensive list of all registered companies via the API, enabling efficient access to company data within the MCP API Server.

Instructions

Lista todas las empresas registradas en la API

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • The main handler function listCompaniesToolHandler that executes the tool logic: fetches companies via service, handles empty list and errors, formats response as formatted text list.
    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 listar-empresas tool: empty object indicating no input parameters required.
    export const listCompaniesInputSchema = {};
  • src/main.ts:62-69 (registration)
    Tool registration in MCP server: registers 'listar-empresas' with its description, input schema, and handler function.
    server.registerTool( "listar-empresas", { description: "Lista todas las empresas registradas en la API", inputSchema: listCompaniesInputSchema }, listCompaniesToolHandler );
  • Supporting getCompanies method in CompanyService class, used by the tool handler to fetch companies data from external API.
    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}`); } }

Other Tools

Related 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