Skip to main content
Glama

jira_delete_worklog

Remove a specific worklog entry from a JIRA issue by providing the issue key and worklog ID, ensuring accurate issue time tracking and management.

Instructions

Delete a worklog entry from an issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYes
worklogIdYes

Implementation Reference

  • DeleteWorklogHandler class implementing the core tool execution logic, including validation, use case execution, and enhanced error handling.
    export class DeleteWorklogHandler extends BaseToolHandler< DeleteWorklogParams, string > { /** * Create a new DeleteWorklogHandler with use case and validator * * @param deleteWorklogUseCase - Use case for deleting worklog entries * @param worklogValidator - Validator for worklog parameters */ constructor( private readonly deleteWorklogUseCase: DeleteWorklogUseCase, private readonly worklogValidator: WorklogValidator, ) { super("JIRA", "Delete Worklog"); } /** * Execute the handler logic * Deletes a worklog entry and returns a success message * * @param params - Parameters for worklog deletion */ protected async execute(params: DeleteWorklogParams): Promise<string> { try { // Step 1: Validate parameters const validatedParams = this.worklogValidator.validateDeleteWorklogParams(params); this.logger.info( `Deleting worklog ${validatedParams.worklogId} from issue: ${validatedParams.issueKey}`, ); // Step 2: Delete worklog using use case const response = await this.deleteWorklogUseCase.execute({ issueKey: validatedParams.issueKey, worklogId: validatedParams.worklogId, }); // Step 3: Return success message return `✅ **Worklog Deleted Successfully**\n\n${response.message}`; } catch (error) { this.logger.error(`Failed to delete worklog: ${error}`); throw this.enhanceError(error, params); } } /** * Enhance error messages for better user guidance */ private enhanceError(error: unknown, params?: DeleteWorklogParams): Error { const issueContext = params?.issueKey ? ` for issue ${params.issueKey}` : ""; const worklogContext = params?.worklogId ? ` (worklog ${params.worklogId})` : ""; if (error instanceof JiraNotFoundError) { return new Error( `❌ **Issue or Worklog Not Found**\n\nNo issue or worklog found${issueContext}${worklogContext}.\n\n**Solutions:**\n- Verify the issue key is correct\n- Verify the worklog ID exists\n- Check if you have permission to view the issue\n\n**Example:** \`jira_delete_worklog issueKey="PROJ-123" worklogId="12345"\``, ); } if (error instanceof JiraPermissionError) { return new Error( `❌ **Permission Denied**\n\nYou don't have permission to delete worklog entries${issueContext}.\n\n**Solutions:**\n- Check your JIRA permissions\n- Contact your JIRA administrator\n- Verify you have work on issues permission\n- Ensure you can delete this specific worklog\n\n**Required Permissions:** Work on Issues`, ); } if (error instanceof JiraApiError) { return new Error( `❌ **JIRA API Error**\n\n${error.message}\n\n**Solutions:**\n- Check the issue key is valid (format: PROJ-123)\n- Verify the worklog ID exists\n- Verify your JIRA connection\n\n**Example:** \`jira_delete_worklog issueKey="PROJ-123" worklogId="12345"\``, ); } if (error instanceof Error) { return new Error( `❌ **Worklog Deletion Failed**\n\n${error.message}${issueContext}${worklogContext}\n\n**Solutions:**\n- Check your parameters are valid\n- Verify your JIRA connection\n- Verify the worklog ID exists\n\n**Example:** \`jira_delete_worklog issueKey="PROJ-123" worklogId="12345"\``, ); } return new Error( `❌ **Unknown Error**\n\nAn unknown error occurred during worklog deletion${issueContext}${worklogContext}.\n\nPlease check your parameters and try again.`, ); } }
  • Zod schema defining the input parameters for the jira_delete_worklog tool: issueKey and worklogId.
    export const deleteWorklogParamsSchema = z.object({ issueKey: issueKeySchema, worklogId: z.string().min(1, "Worklog ID is required"), });
  • Creation of the ToolHandler object for jira_delete_worklog, wrapping the DeleteWorklogHandler's handle method.
    jira_delete_worklog: { handle: async (args: unknown) => deleteWorklogHandler.handle(args), },
  • Tool configuration for jira_delete_worklog, including name, description, parameter schema, and handler binding.
    name: "jira_delete_worklog", description: "Delete a worklog entry from an issue", params: deleteWorklogParamsSchema.shape, handler: tools.jira_delete_worklog.handle.bind(tools.jira_delete_worklog), },
  • Inclusion of jira_delete_worklog in the worklogs tool configuration group for registration with the MCP server.
    configs: createWorklogToolsConfig({ jira_add_worklog: tools.jira_add_worklog, jira_get_worklogs: tools.jira_get_worklogs, jira_update_worklog: tools.jira_update_worklog, jira_delete_worklog: tools.jira_delete_worklog, }),

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/Dsazz/mcp-jira'

If you have feedback or need assistance with the MCP directory API, please join our Discord server