Skip to main content
Glama
nulab

Backlog MCP Server

get_pull_requests_count

Counts pull requests in a repository with optional filters by status, assignee, issue, or creator.

Instructions

Returns count of pull requests for a repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe numeric ID of the project (e.g., 12345)
projectKeyNoThe key of the project (e.g., 'PROJECT')
repoIdNoRepository ID
repoNameNoRepository name
statusIdNoStatus IDs
assigneeIdNoAssignee user IDs
issueIdNoIssue IDs
createdUserIdNoCreated user IDs
organizationNoOptional organization name. Use list_organizations to inspect available organizations.

Implementation Reference

  • The handler function for the 'get_pull_requests_count' tool. It resolves project ID/key and repository ID/name using helper utilities, then calls backlog.getPullRequestsCount().
    export const getPullRequestsCountTool = (
      backlog: Backlog,
      { t }: TranslationHelper
    ): ToolDefinition<
      ReturnType<typeof getPullRequestsCountSchema>,
      (typeof PullRequestCountSchema)['shape']
    > => {
      return {
        name: 'get_pull_requests_count',
        description: t(
          'TOOL_GET_PULL_REQUESTS_COUNT_DESCRIPTION',
          'Returns count of pull requests for a repository'
        ),
        schema: z.object(getPullRequestsCountSchema(t)),
        outputSchema: PullRequestCountSchema,
        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.getPullRequestsCount(
            result.value,
            String(repoResult.value),
            params
          );
        },
      };
    };
  • Input schema definition for the tool, defining optional fields: projectId, projectKey, repoId, repoName, statusId, assigneeId, issueId, createdUserId.
    const getPullRequestsCountSchema = buildToolSchema((t) => ({
      projectId: z
        .number()
        .optional()
        .describe(
          t(
            'TOOL_GET_PULL_REQUESTS_COUNT_PROJECT_ID',
            'The numeric ID of the project (e.g., 12345)'
          )
        ),
      projectKey: z
        .string()
        .optional()
        .describe(
          t(
            'TOOL_GET_PULL_REQUESTS_COUNT_PROJECT_KEY',
            "The key of the project (e.g., 'PROJECT')"
          )
        ),
      repoId: z
        .number()
        .optional()
        .describe(t('TOOL_GET_PULL_REQUESTS_COUNT_REPO_ID', 'Repository ID')),
      repoName: z
        .string()
        .optional()
        .describe(t('TOOL_GET_PULL_REQUESTS_COUNT_REPO_NAME', 'Repository name')),
      statusId: z
        .array(z.number())
        .optional()
        .describe(t('TOOL_GET_PULL_REQUESTS_COUNT_STATUS_ID', 'Status IDs')),
      assigneeId: z
        .array(z.number())
        .optional()
        .describe(
          t('TOOL_GET_PULL_REQUESTS_COUNT_ASSIGNEE_ID', 'Assignee user IDs')
        ),
      issueId: z
        .array(z.number())
        .optional()
        .describe(t('TOOL_GET_PULL_REQUESTS_COUNT_ISSUE_ID', 'Issue IDs')),
      createdUserId: z
        .array(z.number())
        .optional()
        .describe(
          t('TOOL_GET_PULL_REQUESTS_COUNT_CREATED_USER_ID', 'Created user IDs')
        ),
    }));
  • Output schema for the tool - returns an object with a single numeric 'count' field.
    export const PullRequestCountSchema = z.object({
      count: z.number(),
    });
  • Registration of the tool in the 'git' toolset group within the allTools registry.
    getPullRequestsCountTool(backlog, helper),
Behavior2/5

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

No annotations provided; description only states it returns a count, implying a read operation. It does not disclose behavioral traits such as authentication requirements, rate limits, or how filters affect the count.

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

Conciseness4/5

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

Description is a single concise sentence with no wasted words. However, it lacks structure (e.g., bullet points) and could be slightly more informative without losing conciseness.

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 9 parameters and no output schema, the description is too minimal. It does not explain the return format, how filters are applied, or differentiate from sibling counting tools like 'count_issues'.

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

Parameters3/5

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

Schema coverage is 100% with descriptions for all 9 parameters, so baseline is 3. The description adds no additional semantics beyond the schema. It does not explain parameter interactions or defaults.

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?

Description clearly states the tool returns a count of pull requests for a repository. It distinctively uses 'count' vs. other tools like 'get_pull_requests' that return full details. However, it does not mention filtering capabilities that are evident from the schema.

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 on when to use this tool vs. alternatives like 'get_pull_requests' or 'count_issues'. No explicit context for usage or exclusions provided.

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

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