delete_worklog
Remove an existing worklog entry from Tempo's time tracking system in JIRA by specifying the worklog ID to maintain accurate time records.
Instructions
Delete an existing worklog entry
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| worklogId | Yes | Tempo worklog ID to delete |
Input Schema (JSON Schema)
{
"properties": {
"worklogId": {
"description": "Tempo worklog ID to delete",
"type": "string"
}
},
"required": [
"worklogId"
],
"type": "object"
}
Implementation Reference
- src/tools/delete-worklog.ts:9-71 (handler)The primary handler function implementing the delete_worklog tool logic. It validates input implicitly via type, calls TempoClient.deleteWorklog, handles errors with user-friendly messages, and returns MCP CallToolResult.export async function deleteWorklog( tempoClient: TempoClient, input: DeleteWorklogInput ): Promise<CallToolResult> { try { const { worklogId } = input; // First, try to get the worklog details before deletion (for confirmation) let worklogDetails = ''; try { // Note: We could get worklog details first, but the Tempo API might not have a direct endpoint // for getting a single worklog. In practice, this would require getting all worklogs and filtering. // For simplicity, we'll proceed with deletion and provide the ID in the confirmation. worklogDetails = `Worklog ID: ${worklogId}`; } catch (detailError) { // If we can't get details, that's okay - we'll still try to delete worklogDetails = `Worklog ID: ${worklogId} (details unavailable)`; } // Attempt to delete the worklog await tempoClient.deleteWorklog(worklogId); // Format success response let displayText = `## Worklog Deleted Successfully\n\n`; displayText += `The worklog has been permanently removed from Tempo.\n\n`; displayText += `**Details:**\n`; displayText += `- ${worklogDetails}\n`; displayText += `- Deleted at: ${new Date().toISOString()}\n\n`; displayText += `⚠️ **Note:** This action cannot be undone. The worklog and all associated time entries have been permanently removed from your timesheet.\n`; return { content: [ { type: "text", text: displayText } ], isError: false }; } catch (error) { let errorMessage = error instanceof Error ? error.message : String(error); // Provide more helpful error messages for common issues if (errorMessage.includes('not found')) { errorMessage = `Worklog with ID '${input.worklogId}' was not found. It may have already been deleted or the ID may be incorrect.`; } else if (errorMessage.includes('Authentication failed')) { errorMessage += `\n\nTip: Check your Personal Access Token (PAT) in the TEMPO_PAT environment variable.`; } else if (errorMessage.includes('Access forbidden')) { errorMessage += `\n\nTip: Make sure you have permission to delete this worklog. You can typically only delete your own worklogs.`; } return { content: [ { type: "text", text: `## Error Deleting Worklog\n\n**Worklog ID:** ${input.worklogId}\n\n**Error:** ${errorMessage}\n\n**Troubleshooting:**\n- Verify the worklog ID is correct\n- Check that the worklog exists and belongs to you\n- Ensure you have proper permissions in Tempo\n- Confirm your authentication credentials are valid` } ], isError: true }; } }
- src/types/mcp.ts:39-41 (schema)Zod schema defining the input structure for the delete_worklog tool: requires a 'worklogId' string.export const DeleteWorklogInputSchema = z.object({ worklogId: z.string().min(1, "Worklog ID is required"), });
- src/index.ts:177-190 (registration)MCP tool registration in ListToolsRequestHandler: defines name, description, and input schema for delete_worklog.{ name: TOOL_NAMES.DELETE_WORKLOG, description: "Delete an existing worklog entry", inputSchema: { type: "object", properties: { worklogId: { type: "string", description: "Tempo worklog ID to delete", }, }, required: ["worklogId"], }, },
- src/index.ts:236-239 (registration)Tool execution dispatcher in CallToolRequestHandler: parses input using schema and invokes the deleteWorklog handler.case TOOL_NAMES.DELETE_WORKLOG: { const input = DeleteWorklogInputSchema.parse(args); return await deleteWorklog(tempoClient, input); }
- src/tools/index.ts:6-6 (helper)Re-export of the deleteWorklog handler from its implementation file, used by src/index.ts.export { deleteWorklog } from "./delete-worklog.js";