Skip to main content
Glama

updatePerson

Modify user details in Teamwork, including timezone, name, email, job title, and permissions, using the person ID to identify and update specific records.

Instructions

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

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic of the 'updatePerson' tool, processing input, validating, calling the service, and formatting the 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) { logger.error(`Error in updatePerson handler: ${error.message}`); return { content: [{ type: "text", text: `Error updating person: ${error.message}` }] }; } }
  • The tool definition including name, description, input schema, and annotations for the 'updatePerson' tool.
    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 in the toolPairs array, pairing its definition and handler.
    { definition: updatePerson, handler: handleUpdatePerson },
  • Helper service function that performs the actual API call to update a person in Teamwork.
    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}`); } };

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