Skip to main content
Glama

updateCompany

Update a company's address, name, email, phone, and tags by providing the company ID and a request with the new values.

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

  • Tool handler function that validates inputs (companyId, companyData) and calls the service layer to update a company.
    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');
      }
    } 
  • Tool definition (updateCompanyDefinition) with inputSchema describing companyId (integer), companyRequest (object with fields like addressOne, city, company name, etc.), and options.
    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
      }
    };
  • Import and registration of updateCompany tool definition + handler in the toolPairs array.
    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';
    
    // Reporting
    import { getProjectsPeopleMetricsPerformanceDefinition as getProjectsPeopleMetricsPerformance, handleGetProjectsPeopleMetricsPerformance } from './people/getPeopleMetricsPerformance.js';
    import { getProjectsPeopleUtilizationDefinition as getProjectsPeopleUtilization, handleGetProjectsPeopleUtilization } from './people/getPeopleUtilization.js';
    import { getProjectPersonDefinition as getProjectPerson, handleGetProjectPerson } from './people/getProjectPerson.js';
    import { getProjectsReportingUserTaskCompletionDefinition as getProjectsReportingUserTaskCompletion, handleGetProjectsReportingUserTaskCompletion } from './reporting/getUserTaskCompletion.js';
    import { getProjectsReportingUtilizationDefinition as getProjectsReportingUtilization, handleGetProjectsReportingUtilization } from './people/getUtilization.js';
    
    // Time-related imports
    import { getTimeDefinition as getTime, handleGetTime } from './time/getTime.js';
    import { getProjectsAllocationsTimeDefinition as getAllocationTime, handleGetProjectsAllocationsTime } from './time/getAllocationTime.js';
    
    // Core
    import { getTimezonesDefinition as getTimezones, handleGetTimezones } from './core/getTimezones.js';
    
    // Define a structure that pairs tool definitions with their handlers
    interface ToolPair {
      definition: any;
      handler: Function;
    }
    
    // Create an array of tool pairs
    const toolPairs: ToolPair[] = [
      { definition: getProjects, handler: handleGetProjects },
      { definition: getCurrentProject, handler: handleGetCurrentProject },
      { definition: createProject, handler: handleCreateProject },
      { definition: getTasks, handler: handleGetTasks },
      { definition: getTasksByProjectId, handler: handleGetTasksByProjectId },
      { definition: getTaskListsByProjectId, handler: handleGetTaskListsByProjectId },
      { definition: getTasksByTaskListId, handler: handleGetTasksByTaskListId },
      { definition: getTaskById, handler: handleGetTaskById },
      { definition: createTask, handler: handleCreateTask },
      { definition: createSubTask, handler: handleCreateSubTask },
      { definition: updateTask, handler: handleUpdateTask },
      { definition: deleteTask, handler: handleDeleteTask },
      { definition: getTasksMetricsComplete, handler: handleGetTasksMetricsComplete },
      { definition: getTasksMetricsLate, handler: handleGetTasksMetricsLate },
      { definition: getTaskSubtasks, handler: handleGetTaskSubtasks },
      { definition: getTaskComments, handler: handleGetTaskComments },
      { definition: createComment, handler: handleCreateComment },
      { definition: getPeople, handler: handleGetPeople },
      { definition: getPersonById, handler: handleGetPersonById },
      { definition: getProjectPeople, handler: handleGetProjectPeople },
      { definition: addPeopleToProject, handler: handleAddPeopleToProject },
      { definition: deletePerson, handler: handleDeletePerson },
      { definition: updatePerson, handler: handleUpdatePerson },
      { definition: createCompany, handler: handleCreateCompany },
      { definition: updateCompany, handler: handleUpdateCompany },
  • Service layer function that makes the PATCH API call to 'companies/{companyId}.json' with the provided company data.
    import logger from '../../utils/logger.js';
    import { ensureApiClient } from '../core/apiClient.js';
    
    /**
     * Updates an existing company in Teamwork
     * @param companyId The ID of the company to update
     * @param companyData The company data to update
     * @returns The API response
     */
    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}`);
      }
    };
    
    export default updateCompany; 
  • Configuration listing 'updateCompany' under the 'Companies' group for tool permissions.
    'Companies': ['createCompany', 'updateCompany', 'deleteCompany', 'getCompanies', 'getCompanyById']
Behavior2/5

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

Annotations indicate readOnlyHint=false and destructiveHint=false, but description adds no additional behavioral details beyond 'update', such as whether it's a partial update or what side effects occur.

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?

Single sentence is concise, but structure is not optimized; listing parameters in prose is less clear than a structured format.

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 nested input and no output schema, the description lacks detail on the update behavior, typical use cases, and differentiation from sibling tools.

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 provides descriptions for most parameters, but description only repeats parameter names, adding no new semantic value beyond what the schema already offers.

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 updates a company, but does not differentiate from siblings like createCompany, deleteCompany, or other update tools.

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?

No guidance on when to use this tool versus alternatives like createCompany or deleteCompany. No prerequisites or constraints mentioned.

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