Skip to main content
Glama

deletePerson

Remove a person from Teamwork by specifying their ID. This tool simplifies user management by integrating with the Teamwork API to delete individuals from projects.

Instructions

Delete a person from Teamwork

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
personIdYesThe ID of the person to delete

Implementation Reference

  • The handler function for the deletePerson tool. Validates input personId, calls the teamworkService.deletePerson, handles response and errors, returns formatted content.
    export async function handleDeletePerson(input: any) { logger.info('=== deletePerson tool called ==='); logger.info(`Input parameters: ${JSON.stringify(input || {})}`); try { if (!input.personId) { logger.error('Missing required parameter: personId'); return { content: [{ type: "text", text: "Error: Missing required parameter 'personId'" }] }; } const personId = parseInt(input.personId, 10); if (isNaN(personId)) { logger.error(`Invalid personId: ${input.personId}`); return { content: [{ type: "text", text: `Error: Invalid personId. Must be a number.` }] }; } logger.info(`Calling teamworkService.deletePerson(${personId})`); const result = await teamworkService.deletePerson(personId); // Debug the response logger.info(`Delete person response type: ${typeof result}`); try { const jsonString = JSON.stringify(result || { success: true, message: "Person deleted successfully" }, null, 2); logger.info(`Successfully stringified response`); logger.info('=== deletePerson tool completed successfully ==='); return { content: [{ type: "text", text: jsonString }] }; } catch (jsonError: any) { logger.error(`JSON stringify error: ${jsonError.message}`); return { content: [{ type: "text", text: `Error formatting response: ${jsonError.message}` }] }; } } catch (error: any) { logger.error(`Error in deletePerson tool: ${error.message}`); return { content: [{ type: "text", text: `Error: ${error.message}` }] }; } }
  • The schema definition for the deletePerson tool, including name, description, input schema requiring personId (integer), and annotations indicating it's destructive.
    export const deletePersonDefinition = { name: "deletePerson", description: "Delete a person from Teamwork", inputSchema: { type: "object", properties: { personId: { type: "integer", description: "The ID of the person to delete" } }, required: ["personId"] }, annotations: { title: "Delete Person", readOnlyHint: false, destructiveHint: true, openWorldHint: false } };
  • Registration of the deletePerson tool in the toolPairs array, associating its definition and handler for use in the tools index.
    { definition: deletePerson, handler: handleDeletePerson },
  • Helper service function that performs the actual API deletion of a person by ID using the Teamwork API client.
    export const deletePerson = async (personId: number) => { try { logger.info(`Deleting person with ID ${personId} from Teamwork API`); const api = ensureApiClient(); const response = await api.delete(`/people/${personId}.json`); logger.info(`Successfully deleted person with ID ${personId}`); return response.data; } catch (error: any) { logger.error(`Teamwork API error: ${error.message}`); throw new Error(`Failed to delete person with ID ${personId} from Teamwork API`); } };
  • Import statement for the deletePerson tool definition and handler in the tools index file.
    import { deletePersonDefinition as deletePerson, handleDeletePerson } from './people/deletePerson.js';

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