Skip to main content
Glama
ahnmichael

GitLab Forum MCP

by ahnmichael

discourse_list_categories

Retrieve available forum categories to organize discussions and find relevant content for troubleshooting GitLab CI/CD issues and features.

Instructions

List categories visible to the current auth context.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The asynchronous handler function that retrieves categories from the Discourse site's API endpoint `/site.json`, formats them into a bullet list with topic counts, and returns them as text content. Includes error handling to return an error message if the fetch fails.
    async (_args, _extra: any) => { try { const { client } = ctx.siteState.ensureSelectedSite(); const data = (await client.getCached(`/site.json`, 30000)) as any; const cats: any[] = data?.categories || []; const lines = cats.map((c) => `- ${c.name} (${c.topic_count ?? 0} topics)`); const text = lines.length ? lines.join("\n") : "No categories found."; return { content: [{ type: "text", text }] }; } catch (e: any) { return { content: [{ type: "text", text: `Failed to list categories: ${e?.message || String(e)}` }], isError: true }; } }
  • Zod input schema definition for the tool, which is an empty strict object indicating no input parameters are required.
    const schema = z.object({}).strict();
  • The server.registerTool call that registers the "discourse_list_categories" tool, providing its name, title, description, input schema, and the handler function.
    server.registerTool( "discourse_list_categories", { title: "List Categories", description: "List categories visible to the current auth context.", inputSchema: schema.shape, }, async (_args, _extra: any) => { try { const { client } = ctx.siteState.ensureSelectedSite(); const data = (await client.getCached(`/site.json`, 30000)) as any; const cats: any[] = data?.categories || []; const lines = cats.map((c) => `- ${c.name} (${c.topic_count ?? 0} topics)`); const text = lines.length ? lines.join("\n") : "No categories found."; return { content: [{ type: "text", text }] }; } catch (e: any) { return { content: [{ type: "text", text: `Failed to list categories: ${e?.message || String(e)}` }], isError: true }; } } );

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/ahnmichael/gitlab-forum-mcp'

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