create_project_wiki_page
Automate the creation of a new wiki page for a GitLab project, specifying title, content, format, and project ID to streamline documentation processes.
Instructions
Create a new wiki page for a GitLab project
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| content | No | ||
| format | No | ||
| project_id | No | ||
| title | No |
Input Schema (JSON Schema)
{
"properties": {
"content": {
"type": "string"
},
"format": {
"enum": [
"markdown",
"rdoc",
"asciidoc",
"org"
],
"type": "string"
},
"project_id": {
"type": "string"
},
"title": {
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/index.ts:583-591 (handler)Primary MCP tool handler: parses arguments using the schema, delegates to GitLabApi.createProjectWikiPage, and returns formatted response.case "create_project_wiki_page": { const args = CreateProjectWikiPageSchema.parse(request.params.arguments); const wikiPage = await gitlabApi.createProjectWikiPage(args.project_id, { title: args.title, content: args.content, format: args.format }); return formatWikiPageResponse(wikiPage); }
- src/gitlab-api.ts:919-955 (helper)GitLab API client method implementing the wiki page creation via POST to /projects/{projectId}/wikis endpoint.async createProjectWikiPage( projectId: string, options: { title: string; content: string; format?: WikiPageFormat; } ): Promise<GitLabWikiPage> { const response = await fetch( `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/wikis`, { method: "POST", headers: { Authorization: `Bearer ${this.token}`, "Content-Type": "application/json", }, body: JSON.stringify({ title: options.title, content: options.content, format: options.format || "markdown", }), } ); 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); }
- src/schemas.ts:533-538 (schema)Zod input schema for the tool defining required parameters: project_id, title, content; optional format.export const CreateProjectWikiPageSchema = z.object({ project_id: z.string(), title: z.string(), content: z.string(), format: WikiPageFormatEnum.optional() });
- src/index.ts:206-209 (registration)Tool definition in ALL_TOOLS array used for registration in listTools response and read-only filtering.name: "create_project_wiki_page", description: "Create a new wiki page for a GitLab project", inputSchema: createJsonSchema(CreateProjectWikiPageSchema), readOnly: false