Skip to main content
Glama
pHequals7

Tracxn MCP Server

by pHequals7

get_company

Fetch detailed company information from Tracxn using a unique company identifier to access comprehensive business data and insights.

Instructions

Fetch detailed information about a company from Tracxn

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyIdYesThe unique identifier of the company

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
nameYes
descriptionNo

Implementation Reference

  • Executes the get_company tool: parses arguments, validates companyId, calls Tracxn API to fetch company details, handles errors, and returns JSON response.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
      if (!args) {
        throw new Error('No arguments provided');
      }
      if (name !== 'get_company') {
        throw new Error(`Unknown tool: ${name}`);
      }
      
      // Check if API key is available
      if (!process.env.TRACXN_API_KEY) {
        throw new Error('TRACXN_API_KEY environment variable is not set');
      }
      
      const toolArgs = args as unknown as ToolArgs;
      if (!toolArgs.companyId) {
        throw new Error('companyId is required');
      }
      
      try {
        const response = await tracxnClient.get(`/companies/${toolArgs.companyId}`);
        
        // Check if response is HTML (login page)
        if (typeof response.data === 'string' && response.data.includes('<!DOCTYPE html>')) {
          throw new Error('Received HTML response instead of JSON. This usually means authentication failed. Please check your API key.');
        }
        
        return {
          content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
          isError: false
        };
      } catch (error: any) {
        if (error.response?.status === 401) {
          throw new Error('Authentication failed. Please check your API key.');
        } else if (error.response?.status === 403) {
          throw new Error('Access forbidden. Please check your API key permissions.');
        } else if (error.response?.status === 404) {
          throw new Error(`Company with ID ${toolArgs.companyId} not found.`);
        } else {
          throw new Error(`API request failed: ${error.message}`);
        }
      }
    });
  • Defines the tool schema including input (companyId string) and output (id, name, description).
    const getCompanyTool: Tool = {
      name: 'get_company',
      description: 'Fetch detailed information about a company from Tracxn',
      inputSchema: {
        type: 'object',
        properties: {
          companyId: {
            type: 'string',
            description: 'The unique identifier of the company'
          }
        },
        required: ['companyId']
      },
      outputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string' },
          name: { type: 'string' },
          description: { type: 'string' }
        },
        required: ['id', 'name']
      }
    };
  • Registers get_company tool to be discoverable via ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async (request) => {
      return {
        tools: [getCompanyTool]
      };
    });
  • src/index.ts:42-42 (registration)
    Invokes registration of tools including get_company on the main MCP server instance.
    await registerTracxnTools(server);

Tool Definition Quality

Score is being calculated. Check back soon.

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/pHequals7/tracxn-mcp'

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