Skip to main content
Glama

updateCompany

Modify company details in Teamwork, including address, contact information, and tags, by providing the company ID and updated data.

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 for the 'updateCompany' tool. It extracts companyId and companyRequest from input, validates them, calls the teamwork service to update the company, and returns the result or error response.
    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) {
        return createErrorResponse(error, 'Updating company');
      }
    } 
  • The tool definition object containing the name, description, inputSchema (with detailed 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
      }
    };
  • Imports the updateCompanyDefinition and handleUpdateCompany from the specific tool file, aliased for registration in the tools index.
    import { createCompanyDefinition as createCompany, handleCreateCompany } from './companies/createCompany.js';
    import { updateCompanyDefinition as updateCompany, handleUpdateCompany } from './companies/updateCompany.js';
    import { deleteCompanyDefinition as deleteCompany, handleDeleteCompany } from './companies/deleteCompany.js';
    import { getCompaniesDefinition as getCompanies, handleGetCompanies } from './companies/getCompanies.js';
    import { getCompanyByIdDefinition as getCompanyById, handleGetCompanyById } from './companies/getCompanyById.js';
  • Adds the updateCompany tool to the toolPairs array, pairing its definition with the handler function for global registration.
    { definition: createCompany, handler: handleCreateCompany },
    { definition: updateCompany, handler: handleUpdateCompany },
    { definition: deleteCompany, handler: handleDeleteCompany },
  • Helper service function that makes the actual PATCH API request to Teamwork to update the company data.
    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}`);
      }
    };
Behavior2/5

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

Annotations indicate this is a mutation tool (readOnlyHint: false) that isn't destructive, but the description adds minimal behavioral context. It doesn't mention permission requirements, whether updates are partial/full, validation rules, or error conditions. With annotations covering basic safety, the description should provide more operational details.

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 brief (one sentence) and front-loaded with the core purpose. However, it wastes space stating 'It requires parameters' which is obvious from the schema, rather than providing valuable guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 3 parameters (including a complex nested object), no output schema, and moderate schema coverage, the description is inadequate. It doesn't explain what happens after update, error handling, or provide examples. The annotations help but don't compensate for the lack of operational guidance.

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 67%, and the description only lists parameter names ('companyId and companyRequest') without explaining their purpose or relationships. It doesn't add meaningful semantics beyond what the schema provides, such as explaining the structure of companyRequest or the optional 'options' parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states 'update a company' which is a clear verb+resource, but it's generic and doesn't differentiate from sibling tools like 'updatePerson' or 'updateTask'. It doesn't specify what aspects of a company can be updated or the scope of changes.

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 like 'createCompany' or 'deleteCompany'. It doesn't mention prerequisites (e.g., needing an existing company ID) or contextual constraints for updating companies versus other entities.

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