Skip to main content
Glama

updatePerson

Modify user information in Teamwork, including name, email, timezone, and role details, to keep team member profiles current and accurate.

Instructions

Update a person in Teamwork. This endpoint allows you to modify user information like timezone, name, email, etc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
personIdYesThe ID of the person to update
first-nameNoFirst name of the person
last-nameNoLast name of the person
email-addressNoEmail address of the person
titleNoJob title or position of the person
phone-number-officeNoOffice phone number
timezoneIdNoTimezone ID for the person
administratorNoMake this person an administrator
user-typeNoUser type (account, collaborator, contact)
company-idNoID of the company the person belongs to

Implementation Reference

  • The handler function that implements the core logic of the updatePerson tool. It processes the input, validates personId, constructs the updateData object, calls the teamwork service, and returns the result or error response.
    export async function handleUpdatePerson(input: any) {
      logger.info('Calling teamworkService.updatePerson()');
      logger.info(`Person ID: ${input.personId}`);
      
      try {
        const personId = input.personId;
        
        if (!personId) {
          throw new Error("Person ID is required");
        }
        
        // Create update data object with the person wrapper
        const updateData: { person: Record<string, any> } = {
          person: {}
        };
        
        // Copy all fields from input to updateData.person 
        // except personId which is used for the API path
        Object.keys(input).forEach(key => {
          if (key !== 'personId') {
            updateData.person[key] = input[key];
          }
        });
        
        // Make sure we're not sending an empty update
        if (Object.keys(updateData.person).length === 0) {
          throw new Error("At least one field to update must be provided");
        }
        
        logger.info(`Sending update data: ${JSON.stringify(updateData)}`);
        const result = await teamworkService.updatePerson(personId, updateData);
        logger.info(`Successfully updated person with ID: ${personId}`);
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(result, null, 2)
          }]
        };
      } catch (error: any) {
        return createErrorResponse(error, 'Updating person');
      }
    } 
  • The tool definition including name, description, input schema with properties for person updates, and annotations.
    export const updatePersonDefinition = {
      name: "updatePerson",
      description: "Update a person in Teamwork. This endpoint allows you to modify user information like timezone, name, email, etc.",
      inputSchema: {
        type: 'object',
        properties: {
          personId: {
            type: 'integer',
            description: 'The ID of the person to update'
          },
          // Field names match the Swagger definition
          "first-name": {
            type: 'string',
            description: 'First name of the person'
          },
          "last-name": {
            type: 'string',
            description: 'Last name of the person'
          },
          "email-address": {
            type: 'string',
            description: 'Email address of the person'
          },
          "title": {
            type: 'string',
            description: 'Job title or position of the person'
          },
          "phone-number-office": {
            type: 'string',
            description: 'Office phone number'
          },
          "timezoneId": {
            type: 'integer',
            description: 'Timezone ID for the person'
          },
          "administrator": {
            type: 'boolean',
            description: 'Make this person an administrator'
          },
          "user-type": {
            type: 'string',
            description: 'User type (account, collaborator, contact)'
          },
          "company-id": {
            type: 'integer',
            description: 'ID of the company the person belongs to'
          }
        },
        required: ['personId']
      },
      annotations: {
        title: "Update a Person",
        readOnlyHint: false,
        destructiveHint: false,
        openWorldHint: false
      }
    };
  • Registration of the updatePerson tool: import of definition and handler, inclusion in toolPairs array for mapping, and re-export.
    import { updatePersonDefinition as updatePerson, handleUpdatePerson } from './people/updatePerson.js';
    
    // Companies
    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';
    
    // 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 },
      { definition: deleteCompany, handler: handleDeleteCompany },
      { definition: getCompanies, handler: handleGetCompanies },
      { definition: getCompanyById, handler: handleGetCompanyById },
      { definition: getProjectsPeopleMetricsPerformance, handler: handleGetProjectsPeopleMetricsPerformance },
      { definition: getProjectsPeopleUtilization, handler: handleGetProjectsPeopleUtilization },
      { definition: getAllocationTime, handler: handleGetProjectsAllocationsTime },
      { definition: getTime, handler: handleGetTime },
      { definition: getProjectPerson, handler: handleGetProjectPerson },
      { definition: getProjectsReportingUserTaskCompletion, handler: handleGetProjectsReportingUserTaskCompletion },
      { definition: getProjectsReportingUtilization, handler: handleGetProjectsReportingUtilization },
      { definition: getTimezones, handler: handleGetTimezones }
    ];
    
    // Extract just the definitions for the toolDefinitions array
    export const toolDefinitions = toolPairs.map(pair => pair.definition);
    
    // Create a map of tool names to their handler functions
    export const toolHandlersMap: Record<string, Function> = toolPairs.reduce((map, pair) => {
      map[pair.definition.name] = pair.handler;
      return map;
    }, {} as Record<string, Function>);
    
    // Export all tool handlers
    export { handleGetProjects } from './projects/getProjects.js';
    export { handleGetCurrentProject } from './projects/getCurrentProject.js';
    export { handleCreateProject } from './projects/createProject.js';
    export { handleGetTasks } from './tasks/getTasks.js';
    export { handleGetTasksByProjectId } from './tasks/getTasksByProjectId.js';
    export { handleGetTaskListsByProjectId } from './tasks/getTaskListsByProjectId.js';
    export { handleGetTaskById } from './tasks/getTaskById.js';
    export { handleGetTasksByTaskListId } from './tasks/getTasksByTaskListId.js';
    export { handleCreateTask } from './tasks/createTask.js';
    export { handleCreateSubTask } from './tasks/createSubTask.js';
    export { handleUpdateTask } from './tasks/updateTask.js';
    export { handleDeleteTask } from './tasks/deleteTask.js';
    export { handleGetTasksMetricsComplete } from './tasks/getTasksMetricsComplete.js';
    export { handleGetTasksMetricsLate } from './tasks/getTasksMetricsLate.js';
    export { handleGetTaskSubtasks } from './tasks/getTaskSubtasks.js';
    export { handleGetTaskComments } from './tasks/getTaskComments.js';
    export { handleCreateComment } from './comments/createComment.js';
    export { handleGetPeople } from './people/getPeople.js';
    export { handleGetPersonById } from './people/getPersonById.js';
    export { handleGetProjectPeople } from './people/getProjectPeople.js';
    export { handleAddPeopleToProject } from './people/addPeopleToProject.js';
    export { handleDeletePerson } from './people/deletePerson.js';
    export { handleUpdatePerson } from './people/updatePerson.js';
  • The service function called by the tool handler to perform the actual API update on the person via the Teamwork API.
    export const updatePerson = async (personId: number, updateData: any) => {
      try {
        logger.info(`Updating person with ID ${personId}`);
        logger.info(`Update data: ${JSON.stringify(updateData)}`);
        
        const api = getApiClientForVersion('v1');
        // Note: We use put because this is a v1 API endpoint (the base path is handled by the API client)
        const response = await api.put(`people/${personId}.json`, updateData);
        
        logger.info(`Successfully updated person with ID ${personId}`);
        return response.data;
      } catch (error: any) {
        logger.error(`Error updating person with ID ${personId}: ${error.message}`);
        throw new Error(`Failed to update person with ID ${personId}: ${error.message}`);
      }
    };
Behavior3/5

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

Annotations already indicate this is a mutation tool (readOnlyHint=false, destructiveHint=false), so the agent knows it's a non-destructive write operation. The description adds minimal behavioral context beyond annotations, mentioning it modifies user information but not detailing permissions, rate limits, or response format. No contradiction with annotations exists.

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 concise with two sentences that directly state the tool's function and examples. It's front-loaded with the core purpose. However, the second sentence could be more tightly integrated, and there's minor redundancy (e.g., 'update' and 'modify').

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 complexity (10 parameters, mutation operation) and lack of output schema, the description is minimally adequate. Annotations cover safety (non-destructive), and schema covers parameters, but the description doesn't address response format, error conditions, or integration with sibling tools. It meets basic needs but leaves gaps for effective agent use.

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 the schema fully documents all 10 parameters. The description adds marginal value by listing example fields (timezone, name, email) that align with some parameters, but it doesn't provide additional syntax, constraints, or meaning beyond what's in the schema. Baseline score of 3 is appropriate given high schema coverage.

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: 'Update a person in Teamwork' with specific examples of modifiable fields (timezone, name, email, etc.). It distinguishes from siblings like 'deletePerson' and 'getPersonById' by emphasizing modification rather than deletion or retrieval. However, it doesn't explicitly differentiate from 'updateCompany' or 'updateTask' beyond the resource type.

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 prerequisites (e.g., needing personId), exclusions (e.g., what fields cannot be updated), or comparisons to sibling tools like 'updateCompany' or 'updateTask'. Usage is implied by the action 'update a person' but lacks explicit context.

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