Skip to main content
Glama

jira_update_worklog

Modify existing worklog entries in JIRA to update time tracking, comments, or visibility settings for accurate project reporting.

Instructions

Update an existing worklog entry

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYes
worklogIdYes
timeSpentNo
commentNo
startedNo
visibilityNo

Implementation Reference

  • The core handler class for the jira_update_worklog tool. Handles parameter validation, executes the update worklog use case, formats the response, and provides enhanced error messages with solutions.
    export class UpdateWorklogHandler extends BaseToolHandler< UpdateWorklogParams, string > { private formatter: WorklogEntryFormatter; /** * Create a new UpdateWorklogHandler with use case and validator * * @param updateWorklogUseCase - Use case for updating worklog entries * @param worklogValidator - Validator for worklog parameters */ constructor( private readonly updateWorklogUseCase: UpdateWorklogUseCase, private readonly worklogValidator: WorklogValidator, ) { super("JIRA", "Update Worklog"); this.formatter = new WorklogEntryFormatter(); } /** * Execute the handler logic * Updates a worklog entry and formats the result * * @param params - Parameters for worklog update */ protected async execute(params: UpdateWorklogParams): Promise<string> { try { // Step 1: Validate parameters const validatedParams = this.worklogValidator.validateUpdateWorklogParams(params); this.logger.info( `Updating worklog ${validatedParams.worklogId} for issue: ${validatedParams.issueKey}`, ); // Step 2: Update worklog using use case const response = await this.updateWorklogUseCase.execute({ issueKey: validatedParams.issueKey, worklogId: validatedParams.worklogId, timeSpent: validatedParams.timeSpent, comment: validatedParams.comment, started: validatedParams.started, }); // Step 3: Format worklog using the formatter return this.formatter.format(response.worklog); } catch (error) { this.logger.error(`Failed to update worklog: ${error}`); throw this.enhanceError(error, params); } } /** * Enhance error messages for better user guidance */ private enhanceError(error: unknown, params?: UpdateWorklogParams): 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_update_worklog issueKey="PROJ-123" worklogId="12345" timeSpent="3h"\``, ); } if (error instanceof JiraPermissionError) { return new Error( `❌ **Permission Denied**\n\nYou don't have permission to update 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 edit 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- Verify the time format (e.g., "2h", "30m", "1d")\n- Check the issue key is valid (format: PROJ-123)\n- Verify the worklog ID exists\n- Verify the started date is in ISO format\n\n**Example:** \`jira_update_worklog issueKey="PROJ-123" worklogId="12345" timeSpent="3h"\``, ); } if (error instanceof Error) { return new Error( `❌ **Worklog Update Failed**\n\n${error.message}${issueContext}${worklogContext}\n\n**Solutions:**\n- Check your parameters are valid\n- Verify your JIRA connection\n- Ensure time format is correct (e.g., "2h", "30m")\n- Verify the worklog ID exists\n\n**Example:** \`jira_update_worklog issueKey="PROJ-123" worklogId="12345" timeSpent="3h"\``, ); } return new Error( `❌ **Unknown Error**\n\nAn unknown error occurred during worklog update${issueContext}${worklogContext}.\n\nPlease check your parameters and try again.`, ); } }
  • Zod schema defining the input parameters and validation rules for the jira_update_worklog tool.
    export const updateWorklogParamsSchema = z.object({ issueKey: issueKeySchema, worklogId: z.string().min(1, "Worklog ID is required"), // Fields to update timeSpent: z .string() .min(1, "Time spent is required") .regex( /^\d+[wdhm]$/, "Time spent must be in format like '2w', '3d', '4h', '30m'", ) .optional(), comment: z .string() .max(32767, "Comment too long (max 32,767 characters)") .optional(), started: z .string() .datetime("Started time must be a valid ISO datetime") .optional(), // Visibility settings visibility: z .object({ type: z.enum(["group", "role"]), value: z.string().min(1), }) .optional(), });
  • Tool configuration object defining name, description, parameters schema, and handler for registration of jira_update_worklog.
    { name: "jira_update_worklog", description: "Update an existing worklog entry", params: updateWorklogParamsSchema.shape, handler: tools.jira_update_worklog.handle.bind(tools.jira_update_worklog), },
  • Factory creating the thin wrapper handler object for jira_update_worklog that delegates to the UpdateWorklogHandler instance.
    jira_update_worklog: { handle: async (args: unknown) => updateWorklogHandler.handle(args), },
  • Registration group configuration including the jira_update_worklog tool handler in the worklogs group for MCP server registration.
    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