list_project_wiki_pages
Retrieve all wiki pages for a specified GitLab project, optionally including content, to streamline documentation access and management.
Instructions
List all wiki pages for a GitLab project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | ||
| with_content | No |
Input Schema (JSON Schema)
{
"properties": {
"project_id": {
"type": "string"
},
"with_content": {
"type": "boolean"
}
},
"type": "object"
}
Implementation Reference
- src/gitlab-api.ts:824-860 (handler)Core handler function in GitLabApi class that fetches and returns the list of wiki pages for a given project using the GitLab API.async listProjectWikiPages( projectId: string, options: { with_content?: boolean; } = {} ): Promise<GitLabWikiPagesResponse> { const url = new URL( `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/wikis` ); // Add query parameters if (options.with_content) { url.searchParams.append("with_content", "true"); } const response = await fetch(url.toString(), { headers: { Authorization: `Bearer ${this.token}`, }, }); if (!response.ok) { throw new McpError( ErrorCode.InternalError, `GitLab API error: ${response.statusText}` ); } // Parse the response JSON const wikiPages = await response.json() as any[]; // Validate and return the response return GitLabWikiPagesResponseSchema.parse({ count: wikiPages.length, items: wikiPages, }); }
- src/schemas.ts:521-524 (schema)Input schema definition using Zod for validating tool arguments (project_id and optional with_content).export const ListProjectWikiPagesSchema = z.object({ project_id: z.string(), with_content: z.boolean().optional() });
- src/index.ts:193-198 (registration)Tool registration in the ALL_TOOLS array, specifying name, description, input schema, and read-only status.{ name: "list_project_wiki_pages", description: "List all wiki pages for a GitLab project", inputSchema: createJsonSchema(ListProjectWikiPagesSchema), readOnly: true },
- src/index.ts:566-572 (handler)Dispatch handler in the main switch statement that parses arguments, calls the GitLabApi handler, formats response, and returns it.case "list_project_wiki_pages": { const args = ListProjectWikiPagesSchema.parse(request.params.arguments); const wikiPages = await gitlabApi.listProjectWikiPages(args.project_id, { with_content: args.with_content }); return formatWikiPagesResponse(wikiPages); }