Skip to main content
Glama

edit_project_wiki_page

Modify an existing GitLab project wiki page by updating content, title, format, or slug. Use this tool to maintain accurate and up-to-date project documentation efficiently.

Instructions

Edit an existing wiki page for a GitLab project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNo
formatNo
project_idNo
slugNo
titleNo

Implementation Reference

  • Core handler function that sends a PUT request to the GitLab API to edit the specified project wiki page.
    async editProjectWikiPage(
      projectId: string,
      slug: string,
      options: {
        title?: string;
        content?: string;
        format?: WikiPageFormat;
      }
    ): Promise<GitLabWikiPage> {
      const response = await fetch(
        `${this.apiUrl}/projects/${encodeURIComponent(projectId)}/wikis/${encodeURIComponent(slug)}`,
        {
          method: "PUT",
          headers: {
            Authorization: `Bearer ${this.token}`,
            "Content-Type": "application/json",
          },
          body: JSON.stringify({
            title: options.title,
            content: options.content,
            format: options.format,
          }),
        }
      );
    
      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);
    }
  • Zod schema defining the input parameters for the edit_project_wiki_page tool.
    export const EditProjectWikiPageSchema = z.object({
      project_id: z.string(),
      slug: z.string(),
      title: z.string().optional(),
      content: z.string().optional(),
      format: WikiPageFormatEnum.optional()
    });
  • src/index.ts:211-216 (registration)
    Tool registration in the ALL_TOOLS array, defining name, description, input schema, and read-only status.
    {
      name: "edit_project_wiki_page",
      description: "Edit an existing wiki page for a GitLab project",
      inputSchema: createJsonSchema(EditProjectWikiPageSchema),
      readOnly: false
    },
  • Dispatch handler in the main CallToolRequest switch that parses args and calls the GitLab API method.
    case "edit_project_wiki_page": {
      const args = EditProjectWikiPageSchema.parse(request.params.arguments);
      const wikiPage = await gitlabApi.editProjectWikiPage(args.project_id, args.slug, {
        title: args.title,
        content: args.content,
        format: args.format
      });
      return formatWikiPageResponse(wikiPage);
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yoda-digital/mcp-gitlab-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server