Skip to main content
Glama
aaronsb

Confluence MCP Server

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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states this is a read operation ('Get'), which is clear, but doesn't mention other behavioral traits like whether it requires authentication, rate limits, pagination for large label sets, or the format of returned data. The description adds some context about categorization and finding related content, but lacks operational details needed for a tool with no annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: the first sentence 'Get labels for a page' directly states the purpose, and the second sentence 'Use this to understand page categorization and find related content through common labels' adds valuable context without redundancy. Both sentences earn their place by clarifying usage, making it efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is somewhat complete but has gaps. It explains the purpose and usage context, but without annotations or output schema, it doesn't cover behavioral aspects like response format or error handling. For a simple read tool, this is adequate but not fully comprehensive, leaving the agent to infer some operational details.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'pageId' documented as 'ID of the page'. The description doesn't add any parameter-specific information beyond what the schema provides, such as examples of page IDs or where to find them. With high schema coverage, the baseline is 3, as the schema already handles parameter documentation adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get labels for a page' specifies the verb (get) and resource (labels for a page). It distinguishes from siblings like 'add_confluence_label' or 'remove_confluence_label' by focusing on retrieval rather than modification. However, it doesn't explicitly differentiate from other read operations like 'get_confluence_page' beyond mentioning categorization context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance: 'Use this to understand page categorization and find related content through common labels' suggests it's for analyzing labels to discover connections. It doesn't explicitly state when to use this versus alternatives like 'get_confluence_page' (which might include labels) or 'search_confluence_pages' (which might filter by labels), nor does it mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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