Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo
with_contentNo

Implementation Reference

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

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