Skip to content

Commit 9d28ad9

Browse files
Merge pull request #168 from lukeisontheroad/main
Allow accessing issues without project id
2 parents 0d10912 + 478df19 commit 9d28ad9

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

index.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ const allTools = [
498498
},
499499
{
500500
name: "list_issues",
501-
description: "List issues in a GitLab project with filtering options",
501+
description: "List issues (default: created by current user only; use scope='all' for all accessible issues)",
502502
inputSchema: zodToJsonSchema(ListIssuesSchema),
503503
},
504504
{
@@ -1051,20 +1051,25 @@ async function createIssue(
10511051
}
10521052

10531053
/**
1054-
* List issues in a GitLab project
1054+
* List issues across all accessible projects or within a specific project
10551055
* 프로젝트의 이슈 목록 조회
10561056
*
1057-
* @param {string} projectId - The ID or URL-encoded path of the project
1057+
* @param {string} projectId - The ID or URL-encoded path of the project (optional)
10581058
* @param {Object} options - Options for listing issues
10591059
* @returns {Promise<GitLabIssue[]>} List of issues
10601060
*/
10611061
async function listIssues(
1062-
projectId: string,
1062+
projectId?: string,
10631063
options: Omit<z.infer<typeof ListIssuesSchema>, "project_id"> = {}
10641064
): Promise<GitLabIssue[]> {
1065-
projectId = decodeURIComponent(projectId); // Decode project ID
1066-
const effectiveProjectId = getEffectiveProjectId(projectId);
1067-
const url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(effectiveProjectId)}/issues`);
1065+
let url: URL;
1066+
if (projectId) {
1067+
projectId = decodeURIComponent(projectId); // Decode project ID
1068+
const effectiveProjectId = getEffectiveProjectId(projectId);
1069+
url = new URL(`${GITLAB_API_URL}/projects/${encodeURIComponent(effectiveProjectId)}/issues`);
1070+
} else {
1071+
url = new URL(`${GITLAB_API_URL}/issues`);
1072+
}
10681073

10691074
// Add all query parameters
10701075
Object.entries(options).forEach(([key, value]) => {

schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ export const CreateNoteSchema = z.object({
924924

925925
// Issues API operation schemas
926926
export const ListIssuesSchema = z.object({
927-
project_id: z.coerce.string().describe("Project ID or URL-encoded path"),
927+
project_id: z.coerce.string().optional().describe("Project ID or URL-encoded path (optional - if not provided, lists issues across all accessible projects)"),
928928
assignee_id: z.coerce.string().optional().describe("Return issues assigned to the given user ID. user id or none or any"),
929929
assignee_username: z.array(z.string()).optional().describe("Return issues assigned to the given username"),
930930
author_id: z.coerce.string().optional().describe("Return issues created by the given user ID"),

0 commit comments

Comments
 (0)