get_pull_request_comments
Retrieve and manage comments for a specific pull request in Backlog projects by specifying project, repository, and pull request details for streamlined collaboration.
Instructions
Returns list of comments for a pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of comments to retrieve | |
| maxId | No | Maximum comment ID | |
| minId | No | Minimum comment ID | |
| number | Yes | Pull request number | |
| order | No | Sort order | |
| projectIdOrKey | Yes | Project ID or project key | |
| repoIdOrName | Yes | Repository ID or name |
Implementation Reference
- The async handler that implements the core tool logic: resolves project and repository using utility functions, then invokes the Backlog API method getPullRequestComments.handler: async ({ projectId, projectKey, repoId, repoName, number, ...params }) => { const result = resolveIdOrKey( 'project', { id: projectId, key: projectKey }, t ); if (!result.ok) { throw result.error; } const repoResult = resolveIdOrName( 'repository', { id: repoId, name: repoName }, t ); if (!repoResult.ok) { throw repoResult.error; } return backlog.getPullRequestComments( result.value, String(repoResult.value), number, params ); },
- Zod input schema for the tool parameters: projectId/projectKey, repoId/repoName, pull request number, optional filters like minId, maxId, count, order.const getPullRequestCommentsSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_PROJECT_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_PROJECT_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), repoId: z .number() .optional() .describe( t('TOOL_GET_PULL_REQUEST_COMMENTS_REPO_ID_OR_NAME', 'Repository ID') ), repoName: z .string() .optional() .describe( t('TOOL_GET_PULL_REQUEST_COMMENTS_REPO_ID_OR_NAME', 'Repository name') ), number: z .number() .describe( t('TOOL_GET_PULL_REQUEST_COMMENTS_NUMBER', 'Pull request number') ), minId: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_MIN_ID', 'Minimum comment ID')), maxId: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_MAX_ID', 'Maximum comment ID')), count: z .number() .optional() .describe( t( 'TOOL_GET_PULL_REQUEST_COMMENTS_COUNT', 'Number of comments to retrieve' ) ), order: z .enum(['asc', 'desc']) .optional() .describe(t('TOOL_GET_PULL_REQUEST_COMMENTS_ORDER', 'Sort order')), }));
- src/tools/tools.ts:124-135 (registration)Registration of the getPullRequestCommentsTool within the 'git' toolset group in the allTools export.tools: [ getGitRepositoriesTool(backlog, helper), getGitRepositoryTool(backlog, helper), getPullRequestsTool(backlog, helper), getPullRequestsCountTool(backlog, helper), getPullRequestTool(backlog, helper), addPullRequestTool(backlog, helper), updatePullRequestTool(backlog, helper), getPullRequestCommentsTool(backlog, helper), addPullRequestCommentTool(backlog, helper), updatePullRequestCommentTool(backlog, helper), ],
- src/tools/tools.ts:28-28 (registration)Import of the getPullRequestCommentsTool function.import { getPullRequestCommentsTool } from './getPullRequestComments.js';
- Tool schema instantiation and output schema assignment in the tool definition.schema: z.object(getPullRequestCommentsSchema(t)), outputSchema: PullRequestCommentSchema,