get_project_wiki_page
Retrieve a specific wiki page for a GitLab project by providing project ID, slug, and optional version. Supports rendering in HTML format for enhanced readability and integration.
Instructions
Get a specific wiki page for a GitLab project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | ||
| render_html | No | ||
| slug | No | ||
| version | No |
Input Schema (JSON Schema)
{
"properties": {
"project_id": {
"type": "string"
},
"render_html": {
"type": "boolean"
},
"slug": {
"type": "string"
},
"version": {
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:574-581 (handler)Handler logic in the central tool dispatcher switch statement. Parses arguments, calls the GitLab API helper, formats response.case "get_project_wiki_page": { const args = GetProjectWikiPageSchema.parse(request.params.arguments); const wikiPage = await gitlabApi.getProjectWikiPage(args.project_id, args.slug, { render_html: args.render_html, version: args.version }); return formatWikiPageResponse(wikiPage); }
- src/schemas.ts:526-531 (schema)Zod schema defining input parameters for the tool: project_id, slug, optional render_html and version.export const GetProjectWikiPageSchema = z.object({ project_id: z.string(), slug: z.string(), render_html: z.boolean().optional(), version: z.string().optional() });
- src/index.ts:199-204 (registration)Tool registration in the ALL_TOOLS array, including name, description, input schema, and readOnly flag.{ name: "get_project_wiki_page", description: "Get a specific wiki page for a GitLab project", inputSchema: createJsonSchema(GetProjectWikiPageSchema), readOnly: true },
- src/gitlab-api.ts:871-909 (helper)Core implementation in GitLabApi class: constructs API URL for project wiki page, adds query params, fetches from GitLab API, parses and validates response.async getProjectWikiPage( projectId: string, slug: string, options: { render_html?: boolean; version?: string; } = {} ): Promise<GitLabWikiPage> { const url = new URL( `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/wikis/${encodeURIComponent(slug)}` ); // Add query parameters if (options.render_html) { url.searchParams.append("render_html", "true"); } if (options.version) { url.searchParams.append("version", options.version); } 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 wikiPage = await response.json(); // Validate and return the response return GitLabWikiPageSchema.parse(wikiPage); }