getCompanyById
Retrieve detailed company information by ID from Teamwork MCP. Includes options for custom fields, full profiles, and task/project stats to enhance data analysis.
Instructions
Get a specific company by ID. Retrieves detailed information about a company identified by its ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyId | Yes | The ID of the company to retrieve | |
| fullProfile | No | Include full profile information | |
| getStats | No | Include stats of company tasks and projects | |
| includeCustomFields | No | Include custom fields in the response |
Implementation Reference
- src/tools/index.ts:92-93 (registration)Registration of the getCompanyById tool handler and definition in the toolPairs array, which is used to create toolDefinitions and toolHandlersMap.{ definition: getCompanies, handler: handleGetCompanies }, { definition: getCompanyById, handler: handleGetCompanyById },
- src/tools/index.ts:42-42 (registration)Import statement for the tool's schema (definition) and handler function.import { getCompanyByIdDefinition as getCompanyById, handleGetCompanyById } from './companies/getCompanyById.js';
- src/tools/index.ts:141-141 (registration)Re-export of the tool handler for use elsewhere.export { handleGetCompanyById } from './companies/getCompanyById.js';
- Core service function that implements the logic to retrieve a specific company by ID from the Teamwork API. This is the underlying implementation likely called 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}`); } };
- src/services/index.ts:55-55 (helper)Export of the getCompanyById service function in the services index, making it available as teamworkService.getCompanyById in tool handlers.export { createCompany, updateCompany, deleteCompany, getCompanies, getCompanyById };