list_issues
Retrieve and filter Issues from a Gitee repository by state, sorting, labels, assignee, or creator. Manage and track project tasks efficiently with customizable query parameters.
Instructions
列出 Gitee 仓库中的 Issues
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignee | No | Filter issues assigned to a specific user | |
| creator | No | Filter issues created by a specific user | |
| direction | No | Sort direction | desc |
| labels | No | Labels, multiple labels separated by commas | |
| milestone | No | Milestone ID | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| page | No | Page number | |
| per_page | No | Number of items per page, maximum 100 | |
| program | No | Filter issues for a specific program | |
| repo | Yes | Repository path | |
| sort | No | Sort field | created |
| state | No | Issue state | open |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"assignee": {
"description": "Filter issues assigned to a specific user",
"type": "string"
},
"creator": {
"description": "Filter issues created by a specific user",
"type": "string"
},
"direction": {
"default": "desc",
"description": "Sort direction",
"enum": [
"asc",
"desc"
],
"type": "string"
},
"labels": {
"description": "Labels, multiple labels separated by commas",
"type": "string"
},
"milestone": {
"description": "Milestone ID",
"type": "number"
},
"owner": {
"description": "Repository owner path (enterprise, organization, or personal path)",
"type": "string"
},
"page": {
"default": 1,
"description": "Page number",
"type": "integer"
},
"per_page": {
"description": "Number of items per page, maximum 100",
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"program": {
"description": "Filter issues for a specific program",
"type": "string"
},
"repo": {
"description": "Repository path",
"type": "string"
},
"sort": {
"default": "created",
"description": "Sort field",
"enum": [
"created",
"updated",
"comments"
],
"type": "string"
},
"state": {
"default": "open",
"description": "Issue state",
"enum": [
"open",
"closed",
"all"
],
"type": "string"
}
},
"required": [
"owner",
"repo"
],
"type": "object"
}
Implementation Reference
- index.ts:149-157 (registration)Registration of the 'list_issues' MCP tool, specifying name, description, schema from issueOperations, and a handler wrapper that delegates to issueOperations.listIssues.server.registerTool({ name: "list_issues", description: "列出 Gitee 仓库中的 Issues", schema: issueOperations.ListIssuesOptionsSchema, handler: async (params: any) => { const { owner, repo, ...options } = params; return await issueOperations.listIssues(owner, repo, options); }, });
- operations/issues.ts:137-157 (handler)The core handler function listIssues that constructs the Gitee API URL for listing issues, adds query parameters from options, makes the request, and parses the response as an array of GiteeIssueSchema.export async function listIssues( owner: string, repo: string, options: Omit<ListIssuesOptions, "owner" | "repo"> ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = new URL(`${getGiteeApiBaseUrl()}/repos/${owner}/${repo}/issues`); // Add query parameters Object.entries(options).forEach(([key, value]) => { if (value !== undefined) { url.searchParams.append(key, value.toString()); } }); const response = await giteeRequest(url.toString()); return z.array(GiteeIssueSchema).parse(response); }
- operations/issues.ts:25-50 (schema)Zod schema defining the input parameters for the list_issues tool, including owner, repo, state, sort, direction, pagination, and filters.export const ListIssuesOptionsSchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // Issue 状态 state: z.enum(["open", "closed", "all"]).default("open").optional().describe("Issue state"), // 排序字段 sort: z.enum(["created", "updated", "comments"]).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"), // 筛选指定用户负责的 Issue assignee: z.string().optional().describe("Filter issues assigned to a specific user"), // 筛选指定用户创建的 Issue creator: z.string().optional().describe("Filter issues created by a specific user"), // 筛选指定项目的 Issue program: z.string().optional().describe("Filter issues for a specific program"), });