Skip to main content
Glama

list_pull_requests

Retrieve Pull Requests from Gitee repositories by specifying owner, repo, state, sort, and other filters to manage PRs effectively.

Instructions

列出 Gitee 仓库中的 Pull Requests

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionNoSort directiondesc
labelsNoLabels, multiple labels separated by commas
milestoneNoMilestone ID
ownerYesRepository owner path (enterprise, organization, or personal path)
pageNoPage number
per_pageNoNumber of items per page, maximum 100
repoYesRepository path
sortNoSort fieldcreated
stateNoPull Request stateopen

Implementation Reference

  • The main handler function that lists pull requests by constructing the Gitee API URL with query parameters from options and fetching/parsing the response.
    export async function listPullRequests(
      owner: string,
      repo: string,
      options: Omit<ListPullRequestsOptions, "owner" | "repo">
    ) {
      owner = validateOwnerName(owner);
      repo = validateRepositoryName(repo);
    
      const url = new URL(`${getGiteeApiBaseUrl()}/repos/${owner}/${repo}/pulls`);
    
      // Add query parameters
      Object.entries(options).forEach(([key, value]) => {
        if (value !== undefined) {
          url.searchParams.append(key, value.toString());
        }
      });
    
      const response = await giteeRequest(url.toString(), "GET");
    
      return z.array(GiteePullRequestSchema).parse(response);
    }
  • Zod schema defining the input parameters for the list_pull_requests tool, including owner, repo, pagination, filtering, and sorting options.
    export const ListPullRequestsSchema = z.object({
      // 仓库所属空间地址 (企业、组织或个人的地址 path)
      owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"),
      // 仓库路径 (path)
      repo: z.string().describe("Repository path"),
      // Pull Request 状态
      state: z.enum(["open", "closed", "merged", "all"]).default("open").optional().describe("Pull Request state"),
      // 排序字段
      sort: z.enum(["created", "updated", "popularity", "long-running"]).default("created").optional().describe("Sort field"),
      // 排序方向
      direction: z.enum(["asc", "desc"]).default("desc").optional().describe("Sort direction"),
      // 里程碑 ID
      milestone: z.number().optional().describe("Milestone ID"),
      // 标签,多个标签以逗号分隔
      labels: z.string().optional().describe("Labels, multiple labels separated by commas"),
      // 当前的页码
      page: z.number().int().default(1).optional().describe("Page number"),
      // 每页的数量,最大为 100
      per_page: z.number().int().min(1).max(100).optional().describe("Number of items per page, maximum 100"),
    });
  • index.ts:204-212 (registration)
    Registers the list_pull_requests tool with the MCP server, using the schema from pullOperations and delegating to the listPullRequests handler.
    server.registerTool({
      name: "list_pull_requests",
      description: "列出 Gitee 仓库中的 Pull Requests",
      schema: pullOperations.ListPullRequestsSchema,
      handler: async (params: any) => {
        const { owner, repo, ...options } = params;
        return await pullOperations.listPullRequests(owner, repo, options);
      },
    });
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 doesn't mention pagination behavior (implied by 'page' and 'per_page' parameters), rate limits, authentication requirements, or whether it's read-only (though listing suggests it is). More context is needed for a mutation-heavy environment like Gitee.

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, clear sentence in Chinese that directly states the tool's function without unnecessary words. It's front-loaded and wastes no space, making it highly efficient for an AI agent to parse.

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

Completeness3/5

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

For a list operation with 9 parameters (2 required) and no output schema, the description is minimal but not fully complete. It lacks context on return format, pagination defaults, or error handling. However, the high schema coverage (100%) and read-only nature of listing mitigate some gaps, making it adequate but with clear room for improvement.

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 description coverage is 100%, so parameters are well-documented in the schema itself. The description adds no additional parameter semantics beyond implying filtering/scoping (via '列出'), which the schema already covers with fields like 'state', 'labels', etc. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('列出' meaning 'list') and resource ('Pull Requests'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_pull_request' (singular) or 'list_issues', which would require explicit comparison for a score of 5.

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 like 'get_pull_request' (for a specific PR) or 'list_issues' (for issues instead of PRs). The description only states what it does, not when it's appropriate.

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

Related 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/normal-coder/gitee-mcp-server'

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