deleteCompany
Remove a company and all associated data from the Teamwork MCP server by specifying the company ID.
Instructions
This tool allows you to delete a company, be careful with this tool as it will delete the company and all associated data. It requires the following parameters: companyId.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyId | Yes | Path parameter: companyId |
Implementation Reference
- The MCP tool handler for deleteCompany, which extracts companyId from input, calls the teamworkService.deleteCompany service, and formats the response or error.export async function handleDeleteCompany(input: any) { logger.info('Calling teamworkService.deleteCompany()'); logger.info(`Company ID: ${input?.companyId}`); try { const companyId = input.companyId; if (!companyId) { throw new Error("Company ID is required"); } const result = await teamworkService.deleteCompany(companyId); logger.info(`Company deleted successfully with ID: ${companyId}`); return { content: [{ type: "text", text: JSON.stringify({ success: result }, null, 2) }] }; } catch (error: any) { return createErrorResponse(error, 'Deleting company'); } }
- The tool definition including name, description, input schema (requiring companyId), and annotations (destructiveHint: true) for deleteCompany.export const deleteCompanyDefinition = { name: "deleteCompany", description: "This tool allows you to delete a company, be careful with this tool as it will delete the company and all associated data. It requires the following parameters: companyId.", inputSchema: { type: 'object', properties: { companyId: { type: 'integer', description: 'Path parameter: companyId' } }, required: [ 'companyId' ] }, annotations: { title: "Delete Company", readOnlyHint: false, destructiveHint: true, openWorldHint: false } };
- src/tools/index.ts:91-91 (registration)Registration of the deleteCompany tool in the toolPairs array, pairing its definition and handler.{ definition: deleteCompany, handler: handleDeleteCompany },
- The service function called by the tool handler, performing the actual API DELETE request to /companies/{companyId}.json via the api client.export const deleteCompany = async (companyId: number) => { try { logger.info(`Deleting company with ID ${companyId}`); const api = ensureApiClient(); await api.delete(`companies/${companyId}.json`); logger.info(`Successfully deleted company with ID ${companyId}`); return true; } catch (error: any) { logger.error(`Error deleting company with ID ${companyId}: ${error.message}`); throw new Error(`Failed to delete company with ID ${companyId}: ${error.message}`); } };