Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo
render_htmlNo
slugNo
versionNo

Implementation Reference

  • 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);
    }
  • 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
    },
  • 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);
    }

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