Skip to main content
Glama

get_confluence_labels

Retrieve labels from a Confluence page to understand its categorization and identify related content through shared labels.

Instructions

Get labels for a page. Use this to understand page categorization and find related content through common labels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdYesID of the page

Implementation Reference

  • Handler function for get_confluence_labels tool that validates pageId, fetches labels using ConfluenceClient, simplifies the response, and returns JSON-formatted content.
    export async function handleGetConfluenceLabels( client: ConfluenceClient, args: { pageId: string } ): Promise<{ content: Array<{ type: "text"; text: string }>; }> { try { if (!args.pageId) { throw new McpError(ErrorCode.InvalidParams, "pageId is required"); } const labels = await client.getConfluenceLabels(args.pageId); const simplified = { labels: labels.results.map((label: Label) => ({ id: label.id, name: label.name })), next: labels._links.next ? true : false }; return { content: [ { type: "text", text: JSON.stringify(simplified), }, ], }; } catch (error) { console.error("Error getting labels:", error instanceof Error ? error.message : String(error)); throw new McpError( ErrorCode.InternalError, `Failed to get labels: ${error instanceof Error ? error.message : String(error)}` ); }
  • Input schema and description definition for the get_confluence_labels tool.
    get_confluence_labels: { description: "Get labels for a page. Use this to understand page categorization and find related content through common labels.", inputSchema: { type: "object", properties: { pageId: { type: "string", description: "ID of the page", }, }, required: ["pageId"], }, },
  • src/index.ts:261-264 (registration)
    Tool registration and dispatch logic in the main CallToolRequestSchema switch statement.
    case "get_confluence_labels": { const { pageId } = (args || {}) as { pageId: string }; if (!pageId) throw new McpError(ErrorCode.InvalidParams, "pageId is required"); return await handleGetConfluenceLabels(this.confluenceClient, { pageId });
  • ConfluenceClient helper method that makes the actual API call to retrieve paginated labels for a page.
    async getConfluenceLabels(pageId: string): Promise<PaginatedResponse<Label>> { const response = await this.v2Client.get(`/pages/${pageId}/labels`); return response.data; }

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/aaronsb/confluence-cloud-mcp'

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