Skip to main content
Glama
Dsazz

JIRA MCP Server

jira_get_worklogs

Retrieve worklog entries for a specific JIRA issue to track time spent, analyze effort, and monitor progress on tasks.

Instructions

Get all worklog entries for a specific issue

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issueKeyYes
startAtNo
maxResultsNo
startedAfterNo
startedBeforeNo

Implementation Reference

  • The GetWorklogsHandler class implements the core tool execution logic: validates input parameters, invokes the GetWorklogsUseCase, formats the worklog list response, and provides enhanced error messages.
    export class GetWorklogsHandler extends BaseToolHandler<
      GetWorklogsParams,
      string
    > {
      private formatter: WorklogListFormatter;
    
      /**
       * Create a new GetWorklogsHandler with use case and validator
       *
       * @param getWorklogsUseCase - Use case for retrieving worklog entries
       * @param worklogValidator - Validator for worklog parameters
       */
      constructor(
        private readonly getWorklogsUseCase: GetWorklogsUseCase,
        private readonly worklogValidator: WorklogValidator,
      ) {
        super("JIRA", "Get Worklogs");
        this.formatter = new WorklogListFormatter();
      }
    
      /**
       * Execute the handler logic
       * Retrieves worklog entries and formats them
       *
       * @param params - Parameters for worklog retrieval
       */
      protected async execute(params: GetWorklogsParams): Promise<string> {
        try {
          // Step 1: Validate parameters
          const validatedParams =
            this.worklogValidator.validateGetWorklogsParams(params);
          this.logger.info(
            `Getting worklogs for issue: ${validatedParams.issueKey}`,
          );
    
          // Step 2: Get worklogs using use case
          const response = await this.getWorklogsUseCase.execute({
            issueKey: validatedParams.issueKey,
          });
    
          // Step 3: Format worklogs using the formatter
          return this.formatter.format(response.worklogs);
        } catch (error) {
          this.logger.error(`Failed to get worklogs: ${error}`);
          throw this.enhanceError(error, params);
        }
      }
    
      /**
       * Enhance error messages for better user guidance
       */
      private enhanceError(error: unknown, params?: GetWorklogsParams): Error {
        const issueContext = params?.issueKey
          ? ` for issue ${params.issueKey}`
          : "";
    
        if (error instanceof JiraNotFoundError) {
          return new Error(
            `❌ **Issue Not Found**\n\nNo issue found${issueContext}.\n\n**Solutions:**\n- Verify the issue key is correct\n- Check if the issue exists\n- Verify you have permission to view the issue\n\n**Example:** \`jira_get_worklogs issueKey="PROJ-123"\``,
          );
        }
    
        if (error instanceof JiraPermissionError) {
          return new Error(
            `❌ **Permission Denied**\n\nYou don't have permission to view worklog entries${issueContext}.\n\n**Solutions:**\n- Check your JIRA permissions\n- Contact your JIRA administrator\n- Verify you have browse projects permission\n\n**Required Permissions:** Browse Projects`,
          );
        }
    
        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 your JIRA connection\n- Try with a different issue\n\n**Example:** \`jira_get_worklogs issueKey="PROJ-123"\``,
          );
        }
    
        if (error instanceof Error) {
          return new Error(
            `❌ **Worklog Retrieval Failed**\n\n${error.message}${issueContext}\n\n**Solutions:**\n- Check your parameters are valid\n- Verify your JIRA connection\n- Try with a different issue\n\n**Example:** \`jira_get_worklogs issueKey="PROJ-123"\``,
          );
        }
    
        return new Error(
          `❌ **Unknown Error**\n\nAn unknown error occurred during worklog retrieval${issueContext}.\n\nPlease check your parameters and try again.`,
        );
      }
    }
  • Zod schema defining the input parameters for the jira_get_worklogs tool, including issueKey (required), optional pagination (startAt, maxResults), and date filters (startedAfter, startedBefore).
    export const getWorklogsParamsSchema = z.object({
      issueKey: issueKeySchema,
    
      // Optional pagination
      startAt: z.number().int().min(0).optional().default(0),
      maxResults: z.number().int().min(1).max(1000).optional().default(1000),
    
      // Optional date filtering
      startedAfter: z
        .string()
        .datetime("Started after must be a valid ISO datetime")
        .optional(),
    
      startedBefore: z
        .string()
        .datetime("Started before must be a valid ISO datetime")
        .optional(),
    });
  • Tool configuration object used for registering the jira_get_worklogs tool with the MCP server, specifying name, description, input schema, and handler binding.
        name: "jira_get_worklogs",
        description: "Get all worklog entries for a specific issue",
        params: getWorklogsParamsSchema.shape,
        handler: tools.jira_get_worklogs.handle.bind(tools.jira_get_worklogs),
      },
      {
        name: "jira_update_worklog",
        description: "Update an existing worklog entry",
        params: updateWorklogParamsSchema.shape,
        handler: tools.jira_update_worklog.handle.bind(tools.jira_update_worklog),
      },
      {
        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),
      },
    ];
  • Factory function createWorklogHandlers that instantiates the GetWorklogsHandler with dependencies and creates the jira_get_worklogs tool handler wrapper with the handle method.
    function createWorklogHandlers(dependencies: JiraDependencies) {
      const addWorklogHandler = new AddWorklogHandler(
        dependencies.addWorklogUseCase,
        dependencies.worklogValidator,
      );
    
      const getWorklogsHandler = new GetWorklogsHandler(
        dependencies.getWorklogsUseCase,
        dependencies.worklogValidator,
      );
    
      const updateWorklogHandler = new UpdateWorklogHandler(
        dependencies.updateWorklogUseCase,
        dependencies.worklogValidator,
      );
    
      const deleteWorklogHandler = new DeleteWorklogHandler(
        dependencies.deleteWorklogUseCase,
        dependencies.worklogValidator,
      );
    
      return {
        jira_add_worklog: {
          handle: async (args: unknown) => addWorklogHandler.handle(args),
        },
        jira_get_worklogs: {
          handle: async (args: unknown) => getWorklogsHandler.handle(args),
        },
        jira_update_worklog: {
          handle: async (args: unknown) => updateWorklogHandler.handle(args),
        },
        jira_delete_worklog: {
          handle: async (args: unknown) => deleteWorklogHandler.handle(args),
        },
      };
    }
  • Tool registry configuration group for worklogs, passing the jira_get_worklogs handler to createWorklogToolsConfig for final MCP server registration.
    groupName: "worklogs",
    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 but offers minimal behavioral insight. It implies a read-only operation ('Get') but doesn't disclose pagination behavior (via startAt/maxResults), authentication needs, rate limits, error conditions, or return format. For a tool with 5 parameters and no output schema, this is inadequate.

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 a single, efficient sentence with no wasted words. It's front-loaded with the core purpose, making it easy to parse quickly, though this brevity contributes to gaps in other dimensions.

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?

Given 5 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It covers the basic action but misses critical details like parameter meanings, behavioral traits, and output structure, which are essential for effective tool use in this context.

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?

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It mentions 'specific issue' which hints at the 'issueKey' parameter, but ignores the other 4 parameters (startAt, maxResults, startedAfter, startedBefore) that control pagination and date filtering, leaving them undocumented.

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 verb ('Get') and resource ('all worklog entries for a specific issue'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'jira_get_issue' or 'jira_get_issue_comments' which also retrieve issue-related data, missing an opportunity for full sibling distinction.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing issue access), compare to siblings like 'jira_get_issue' (which might include worklogs), or specify use cases like time tracking analysis, leaving the agent with minimal context for selection.

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