Skip to main content
Glama

get_pull_requests

Retrieve a list of pull requests from a repository by specifying project ID, repository name, and optional filters like status, assignee, or issue IDs. Supports pagination for efficient management.

Instructions

Returns list of pull requests for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneeIdNoAssignee user IDs
countNoNumber of pull requests to retrieve
createdUserIdNoCreated user IDs
issueIdNoIssue IDs
offsetNoOffset for pagination
projectIdOrKeyYesProject ID or project key
repoIdOrNameYesRepository ID or name
statusIdNoStatus IDs

Implementation Reference

  • The async handler function that implements the core logic of the 'get_pull_requests' tool: resolves project ID or key and repository ID or name using utility functions, then calls the Backlog API's getPullRequests method with the resolved parameters.
    handler: async ({ projectId, projectKey, repoId, repoName, ...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.getPullRequests( result.value, String(repoResult.value), params ); },
  • Input schema definition using Zod for the 'get_pull_requests' tool parameters, including optional project/repo identifiers and filters like status, assignee, pagination.
    const getPullRequestsSchema = buildToolSchema((t) => ({ projectId: z .number() .optional() .describe( t( 'TOOL_GET_PULL_REQUESTS_PROJECT_ID', 'The numeric ID of the project (e.g., 12345)' ) ), projectKey: z .string() .optional() .describe( t( 'TOOL_GET_PULL_REQUESTS_PROJECT_KEY', "The key of the project (e.g., 'PROJECT')" ) ), repoId: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_REPO_ID', 'Repository ID')), repoName: z .string() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_REPO_NAME', 'Repository name')), statusId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_STATUS_ID', 'Status IDs')), assigneeId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_ASSIGNEE_ID', 'Assignee user IDs')), issueId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_ISSUE_ID', 'Issue IDs')), createdUserId: z .array(z.number()) .optional() .describe(t('TOOL_GET_PULL_REQUESTS_CREATED_USER_ID', 'Created user IDs')), offset: z .number() .optional() .describe(t('TOOL_GET_PULL_REQUESTS_OFFSET', 'Offset for pagination')), count: z .number() .optional() .describe( t('TOOL_GET_PULL_REQUESTS_COUNT', 'Number of pull requests to retrieve') ), }));
  • Registration of the 'get_pull_requests' tool by instantiating getPullRequestsTool with Backlog client and translation helper, and adding it to the 'git' toolset group.
    getPullRequestsTool(backlog, helper),
  • Import of the getPullRequestsTool function definition.
    import { getPullRequestsTool } from './getPullRequests.js';
  • Import of utility functions used in the handler to resolve project/repo identifiers from ID/key or ID/name.
    import { resolveIdOrKey, resolveIdOrName } from '../utils/resolveIdOrKey.js';

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/nulab/backlog-mcp-server'

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