Skip to main content
Glama
aaronsb

Confluence MCP Server

remove_confluence_label

Remove a label from a Confluence page by specifying the page ID and label name. This tool helps clean up page organization and metadata in Confluence Cloud.

Instructions

Remove a label from a page.

Error Handling:

  • Returns 403 for insufficient permissions

  • Returns 404 if page or label not found

Response includes:

  • Success status

  • Operation details (pageId, label, operation type)

  • Success message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdYesID of the page
labelYesLabel to remove

Implementation Reference

  • MCP tool handler: validates parameters, verifies page access, removes the label via client, handles errors, and returns formatted JSON response.
    export async function handleRemoveConfluenceLabel(
      client: ConfluenceClient,
      args: { pageId: string; label: string }
    ): Promise<{
      content: Array<{ type: "text"; text: string }>;
    }> {
      try {
        if (!args.pageId || !args.label) {
          throw new McpError(
            ErrorCode.InvalidParams,
            "pageId and label are required"
          );
        }
    
        // First check if the page exists and is accessible
        try {
          await client.getConfluencePage(args.pageId);
        } catch (error: unknown) {
          if (error instanceof ConfluenceError) {
            switch (error.code) {
              case 'PAGE_NOT_FOUND':
                throw new McpError(ErrorCode.InvalidParams, "Page not found");
              case 'INSUFFICIENT_PERMISSIONS':
                throw new McpError(ErrorCode.InvalidRequest, "Insufficient permissions to access page");
              default:
                throw new McpError(ErrorCode.InternalError, error.message);
            }
          }
          throw error;
        }
    
        await client.removeConfluenceLabel(args.pageId, args.label);
        const simplified = {
          success: true,
          message: `Successfully removed label '${args.label}' from page ${args.pageId}`,
          details: {
            pageId: args.pageId,
            label: args.label,
            operation: 'remove'
          }
        };
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(simplified),
            },
          ],
        };
      } catch (error: unknown) {
        console.error("Error removing label:", error instanceof Error ? error.message : String(error));
        
        if (error instanceof McpError) {
          throw error;
        }
    
        // Handle specific HTTP errors from the Confluence API
        if (error instanceof ConfluenceError) {
          switch (error.code) {
            case 'PAGE_NOT_FOUND':
              throw new McpError(ErrorCode.InvalidParams, "Page not found");
            case 'PERMISSION_DENIED':
              throw new McpError(ErrorCode.InvalidRequest, "You don't have permission to remove labels from this page");
            default:
              throw new McpError(ErrorCode.InternalError, `Failed to remove label: ${error.message}`);
          }
        }
    
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to remove label: ${error instanceof Error ? error.message : String(error)}`
        );
      }
    }
  • Tool schema defining input parameters (pageId, label) and description for the remove_confluence_label tool.
      remove_confluence_label: {
        description: "Remove a label from a page.\n\nError Handling:\n- Returns 403 for insufficient permissions\n- Returns 404 if page or label not found\n\nResponse includes:\n- Success status\n- Operation details (pageId, label, operation type)\n- Success message",
        inputSchema: {
          type: "object",
          properties: {
            pageId: {
              type: "string",
              description: "ID of the page",
            },
            label: {
              type: "string",
              description: "Label to remove",
            },
          },
          required: ["pageId", "label"],
        },
      },
    } as const;
  • src/index.ts:271-275 (registration)
    Tool registration in the main switch dispatcher: extracts arguments, validates, and calls the handler function.
    case "remove_confluence_label": {
      const { pageId, label } = (args || {}) as { pageId: string; label: string };
      if (!pageId || !label) throw new McpError(ErrorCode.InvalidParams, "pageId and label are required");
      return await handleRemoveConfluenceLabel(this.confluenceClient, { pageId, label });
    }
  • Low-level client method that makes the DELETE API call to remove a label from a Confluence page and handles API errors.
    async removeConfluenceLabel(pageId: string, label: string): Promise<void> {
      try {
        await this.v2Client.delete(`/pages/${pageId}/labels/${label}`);
      } catch (error) {
        if (axios.isAxiosError(error)) {
          switch (error.response?.status) {
            case 403:
              throw new ConfluenceError(
                'Insufficient permissions to remove labels',
                'PERMISSION_DENIED'
              );
            case 404:
              throw new ConfluenceError(
                'Page or label not found',
                'PAGE_NOT_FOUND'
              );
            default:
              console.error('Error removing label:', error.response?.data);
              throw new ConfluenceError(
                `Failed to remove label: ${error.message}`,
                'UNKNOWN'
              );
          }
        }
        throw error;
      }
    }
Behavior4/5

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

With no annotations provided, the description carries full burden and does an excellent job disclosing behavioral traits. It specifies error conditions (403 for permissions, 404 for missing resources) and response format details (success status, operation details, success message), going well beyond basic functionality description.

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 perfectly structured and front-loaded with the core functionality first, followed by organized sections for error handling and response details. Every sentence earns its place with zero wasted words, making it highly efficient for agent comprehension.

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 mutation tool with no annotations and no output schema, the description provides excellent coverage of behavior, errors, and response format. It could potentially mention side effects or confirmations, but given the tool's relative simplicity and the comprehensive error/response documentation, it's nearly complete.

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 schema description coverage is 100%, with both parameters clearly documented in the schema. The description doesn't add any additional semantic information about the parameters beyond what the schema already provides, so it meets the baseline expectation without adding extra value.

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

Purpose5/5

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

The description clearly states the specific action ('Remove a label') and resource ('from a page'), distinguishing it from sibling tools like 'add_confluence_label' which performs the opposite operation. The verb+resource combination is precise and unambiguous.

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

Usage Guidelines4/5

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

The description implies usage context through the error handling section (e.g., 'insufficient permissions' suggests authorization needs), but doesn't explicitly state when to use this tool versus alternatives like 'get_confluence_labels' for checking existing labels. It provides clear operational context but lacks explicit sibling differentiation.

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