Skip to main content
Glama

updateCompany

Modify company details such as address, contact information, and tags using the specified companyId and companyRequest parameters within the Teamwork MCP environment.

Instructions

This tool allows you to update a company. It requires parameters: companyId and companyRequest.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
companyIdYesPath parameter: companyId
companyRequestYes
optionsNoAdditional options for the request

Implementation Reference

  • The handler function that implements the core logic of the 'updateCompany' tool. It extracts companyId and companyRequest from input, calls the teamworkService.updateCompany, and returns the result or error message.
    export async function handleUpdateCompany(input: any) { logger.info('Calling teamworkService.updateCompany()'); logger.info(`Company ID: ${input?.companyId}`); try { const companyId = input.companyId; const companyData = input.companyRequest; if (!companyId) { throw new Error("Company ID is required"); } if (!companyData) { throw new Error("Company data is required for update"); } const result = await teamworkService.updateCompany(companyId, companyData); logger.info(`Company updated successfully with ID: ${companyId}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (error: any) { logger.error(`Error in updateCompany handler: ${error.message}`); return { content: [{ type: "text", text: `Error updating company: ${error.message}` }] }; } }
  • The tool schema definition for 'updateCompany', including name, description, detailed inputSchema with properties for company update data, required fields, and annotations.
    export const updateCompanyDefinition = { name: "updateCompany", description: "This tool allows you to update a company. It requires parameters: companyId and companyRequest.", inputSchema: { type: 'object', properties: { companyId: { type: 'integer', description: 'Path parameter: companyId' }, companyRequest: { type: 'object', properties: { addressOne: { type: 'string', description: 'First line of address' }, addressTwo: { type: 'string', description: 'Second line of address' }, city: { type: 'string', description: 'City' }, company: { type: 'object', properties: { name: { type: 'string', description: 'Company name' } } }, countryCode: { type: 'string', description: 'Country code' }, emailOne: { type: 'string', description: 'First email address' }, emailTwo: { type: 'string', description: 'Second email address' }, fax: { type: 'string', description: 'Fax number' }, name: { type: 'string', description: 'Company name' }, phone: { type: 'string', description: 'Phone number' }, state: { type: 'string', description: 'State' }, tags: { type: 'array', items: { type: 'string' }, description: 'List of tags' }, website: { type: 'string', description: 'Website URL' }, zip: { type: 'string', description: 'ZIP/Postal code' } } }, options: { type: 'object', properties: {}, description: 'Additional options for the request' } }, required: [ 'companyId', 'companyRequest' ] }, annotations: { title: "Update Company", readOnlyHint: false, destructiveHint: false, openWorldHint: false } };
  • Registration of the 'updateCompany' tool in the toolPairs array, pairing the definition and handler for use in toolHandlersMap and toolDefinitions.
    { definition: updateCompany, handler: handleUpdateCompany },
  • Import of the updateCompany tool definition and handler from the companies/updateCompany module.
    import { updateCompanyDefinition as updateCompany, handleUpdateCompany } from './companies/updateCompany.js';
  • Helper service function called by the tool handler to perform the actual API PATCH request to update the company in Teamwork.
    export const updateCompany = async (companyId: number, companyData: any) => { try { logger.info(`Updating company with ID ${companyId}`); const api = ensureApiClient(); const response = await api.patch(`companies/${companyId}.json`, companyData); logger.info(`Successfully updated company with ID ${companyId}`); return response.data; } catch (error: any) { logger.error(`Error updating company with ID ${companyId}: ${error.message}`); throw new Error(`Failed to update company with ID ${companyId}: ${error.message}`); } };

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