Skip to main content
Glama
aaronsb

Confluence MCP Server

get_confluence_labels

Retrieve labels assigned to a Confluence page to understand its categorization and discover 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

  • The main handler function `handleGetConfluenceLabels` that executes the tool logic. It takes a ConfluenceClient and { pageId } args, calls client.getConfluenceLabels(pageId), and returns simplified label data (id, name) with pagination info.
    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 definition for the 'get_confluence_labels' tool. Describes the tool purpose (get labels for a page) and input schema requiring a 'pageId' string property.
    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-265 (registration)
    Registration of the tool in the main server's CallToolRequestSchema handler. Case 'get_confluence_labels' extracts pageId from args, validates it, and calls handleGetConfluenceLabels.
    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 });
    }
  • The ConfluenceClient helper method `getConfluenceLabels` that makes the actual HTTP GET request to /pages/{pageId}/labels using the Confluence v2 API client.
    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, and the description does not disclose any behavioral traits such as read-only nature, authentication needs, rate limits, or error conditions. The description carries the full burden but adds minimal transparency.

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?

Two efficient sentences, front-loaded with the action and purpose. No unnecessary words.

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

Completeness4/5

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

For a simple read tool with one required parameter and no output schema, the description adequately covers purpose and usage context. Minor gaps in behavioral details reduce the score.

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% coverage with description for pageId. The tool description does not add any further meaning to the parameter beyond what the schema provides.

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 it gets labels for a page with verb 'Get' and resource 'labels for a page', and explains the purpose of categorization and finding related content. It does not explicitly distinguish from siblings like add_confluence_label but the operation is distinct enough.

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 a context for use ('to understand page categorization and find related content'), but does not specify when not to use it or mention alternative tools like search or page retrieval.

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