Skip to main content
Glama
Dsazz

JIRA MCP Server

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,
    }),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an update operation (implying mutation), but doesn't mention required permissions, whether changes are reversible, rate limits, or what happens to unspecified fields. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single clear sentence that front-loads the essential action. There's no wasted language or unnecessary elaboration, making it efficient for quick understanding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 6 parameters (including nested objects), 0% schema description coverage, no annotations, and no output schema, the description is inadequate. It doesn't compensate for the missing structured information about behavior, parameters, or return values, leaving the agent with insufficient context for proper tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage for all 6 parameters, the description provides no additional semantic context about what each parameter means or how they interact. It doesn't explain what 'worklogId' identifies, the format of 'timeSpent', what 'visibility' controls, or which fields are optional versus required beyond the schema's technical requirements.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Update') and resource ('an existing worklog entry'), making the purpose immediately understandable. It distinguishes this from sibling tools like 'jira_add_worklog' (create new) and 'jira_delete_worklog' (remove), but doesn't explicitly mention these distinctions in the description itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing an existing worklog), compare it to 'jira_add_worklog' for new entries, or specify appropriate contexts for updating versus other operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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