Skip to main content
Glama

getCompanyById

Retrieve detailed company information by ID from the Teamwork MCP server. Use this tool to access company data, custom fields, profiles, and task statistics.

Instructions

Get a specific company by ID. Retrieves detailed information about a company identified by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyIdYesThe ID of the company to retrieve
includeCustomFieldsNoInclude custom fields in the response
fullProfileNoInclude full profile information
getStatsNoInclude stats of company tasks and projects

Implementation Reference

  • The main handler function for the 'getCompanyById' MCP tool. It processes the input, calls the underlying teamwork service, handles errors, and returns a formatted response.
    export async function handleGetCompanyById(input: any) {
      logger.info('Calling teamworkService.getCompanyById()');
      logger.info(`Company ID: ${input?.companyId}`);
      
      try {
        const companyId = input.companyId;
        
        if (!companyId) {
          throw new Error("Company ID is required");
        }
        
        // Prepare query parameters
        const params = { ...input };
        delete params.companyId; // Remove companyId from params as it's used in the path
        
        const result = await teamworkService.getCompanyById(companyId, params);
        logger.info(`Successfully retrieved company with ID: ${companyId}`);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error: any) {
        return createErrorResponse(error, 'Retrieving company');
      }
    } 
  • The schema/definition for the 'getCompanyById' tool, including name, description, input schema with properties like companyId, and annotations.
    export const getCompanyByIdDefinition = {
      name: "getCompanyById",
      description: "Get a specific company by ID. Retrieves detailed information about a company identified by its ID.",
      inputSchema: {
        type: 'object',
        properties: {
          companyId: {
            type: 'integer',
            description: 'The ID of the company to retrieve'
          },
          includeCustomFields: {
            type: 'boolean',
            description: 'Include custom fields in the response'
          },
          fullProfile: {
            type: 'boolean',
            description: 'Include full profile information'
          },
          getStats: {
            type: 'boolean',
            description: 'Include stats of company tasks and projects'
          }
        },
        required: ['companyId']
      },
      annotations: {
        title: "Get Company by ID",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • Registration of the getCompanyById tool in the central toolPairs array, associating its definition and handler for use in the MCP tools system.
    { definition: getCompanyById, handler: handleGetCompanyById },
  • The helper service function that performs the actual API call to retrieve the company by ID from Teamwork, used by the tool handler.
    export const getCompanyById = async (companyId: number, params: any = {}) => {
      try {
        logger.info(`Fetching company with ID ${companyId} from Teamwork API`);
        
        const api = ensureApiClient();
        const response = await api.get(`companies/${companyId}.json`, { params });
        
        logger.info(`Successfully retrieved company with ID ${companyId}`);
        return response.data;
      } catch (error: any) {
        logger.error(`Error fetching company with ID ${companyId}: ${error.message}`);
        throw new Error(`Failed to fetch company with ID ${companyId}: ${error.message}`);
      }
    };
Behavior3/5

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

Annotations already provide readOnlyHint=false, openWorldHint=false, and destructiveHint=false, indicating this is a non-destructive read operation. The description adds minimal behavioral context beyond this - it mentions retrieving 'detailed information' but doesn't specify what details, response format, or any rate limits/authentication requirements. With annotations covering the safety profile, a 3 is appropriate as the description adds some value but limited behavioral insight.

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

Conciseness4/5

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

The description is appropriately concise with two sentences that get straight to the point. The first sentence states the core purpose, and the second elaborates slightly. There's no wasted verbiage, though it could be more front-loaded with key differentiators.

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 moderate complexity (4 parameters, no output schema), the description is minimally adequate. Annotations cover safety aspects, and the schema documents parameters well. However, without an output schema, the description should ideally provide more insight into what 'detailed information' includes and the response structure, which it doesn't do sufficiently.

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

Parameters3/5

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

Schema description coverage is 100%, so all parameters are documented in the schema. The description mentions retrieving 'detailed information' which aligns with the optional parameters (includeCustomFields, fullProfile, getStats) but doesn't add specific meaning beyond what the schema provides. Baseline 3 is correct when the schema does the heavy lifting.

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 tool's purpose: 'Get a specific company by ID' (verb+resource). It distinguishes from sibling 'getCompanies' by specifying retrieval of a single company rather than a list. However, it doesn't explicitly differentiate from 'getPersonById' or other entity-specific getters beyond mentioning 'company'.

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 when to use 'getCompanies' for listing companies, 'updateCompany' for modifications, or 'deleteCompany' for removal. There's no context about prerequisites, error conditions, or typical use cases.

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/Vizioz/Teamwork-MCP'

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