Skip to main content
Glama

zendesk_add_tag

Add a tag to a Zendesk ticket. Returns the ticket ID and current tags; idempotent for existing tags.

Instructions

Add a tag to a Zendesk ticket. Idempotent: adding an existing tag returns the current tag list without modifying the ticket. Returns JSON with ticket_id and current tags.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYes
tagYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'zendesk_add_tag'. Decorated with @mcp.tool(), it delegates to the _add_tag_data helper.
    def zendesk_add_tag(ticket_id: int, tag: str) -> str:
        """Add a tag to a Zendesk ticket. Idempotent: adding an existing tag returns the current tag list without modifying the ticket. Returns JSON with ticket_id and current tags."""
        return _add_tag_data(ticket_id, tag)
  • Core logic for adding a tag. Gets a Zenpy client, checks if the tag already exists (idempotent), appends if not, updates the ticket, and returns JSON with the updated tags.
    def _add_tag_data(ticket_id: int, tag: str) -> str:
        try:
            client = get_client()
            ticket = client.tickets(id=ticket_id)
            current_tags = list(getattr(ticket, "tags", []) or [])
            if tag in current_tags:
                return json.dumps({"ticket_id": ticket_id, "tags": current_tags}, indent=2)
            current_tags.append(tag)
            ticket.tags = current_tags
            client.tickets.update(ticket)
            refreshed = client.tickets(id=ticket_id)
            return json.dumps({"ticket_id": ticket_id, "tags": list(getattr(refreshed, "tags", []) or [])}, indent=2)
        except ConfigError as e:
            return str(e)
        except Exception as e:
            if "RecordNotFound" in str(e) or "404" in str(e):
                return f"Ticket #{ticket_id} not found or not accessible with current credentials."
            return f"Zendesk API error: {e}"
  • Registration function register_tag_tools that uses @mcp.tool() decorator to register zendesk_add_tag and zendesk_remove_tag as MCP tools.
    def register_tag_tools(mcp) -> None:
        @mcp.tool()
        def zendesk_add_tag(ticket_id: int, tag: str) -> str:
            """Add a tag to a Zendesk ticket. Idempotent: adding an existing tag returns the current tag list without modifying the ticket. Returns JSON with ticket_id and current tags."""
            return _add_tag_data(ticket_id, tag)
  • Import of register_tag_tools in the main server module.
    from zendesk_mcp.tools.tags import register_tag_tools
    from zendesk_mcp.tools.views import register_view_tools
    from zendesk_mcp.tools.macros import register_macro_tools
    from zendesk_mcp.tools.users import register_user_tools
    from zendesk_mcp.tools.groups import register_group_tools
    from zendesk_mcp.tools.organizations import register_organization_tools
    from zendesk_mcp.tools.custom_statuses import register_custom_status_tools
    from zendesk_mcp.prompts import register_prompts
    
    register_ticket_tools(mcp)
    register_comments_tools(mcp)
    register_attachment_tools(mcp)
    register_gitlab_context_tools(mcp)
    register_write_comment_tools(mcp)
    register_update_ticket_tools(mcp)
    register_time_tracking_tools(mcp)
    register_git_zen_tools(mcp)
    register_create_ticket_tools(mcp)
    register_list_tickets_tools(mcp)
    register_knowledge_base_resource(mcp)
    register_tag_tools(mcp)
  • Invocation of register_tag_tools(mcp) to register the tag tools during server startup.
    register_tag_tools(mcp)
Behavior4/5

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

Since no annotations exist, the description carries the full burden. It discloses idempotency and return format (JSON with ticket_id and current tags), which adds meaningful behavioral context.

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 sentences with no filler. First sentence states the action, second adds idempotency and return value. Efficient and front-loaded.

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 add-tag operation with an output schema, the description covers the key return information. However, it lacks parameter details and usage guidance, which keeps it from a perfect 5.

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

Parameters2/5

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

Schema has 0% parameter descriptions. The description does not explain the meaning or constraints of ticket_id or tag beyond their names, missing a chance to compensate.

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 'Add a tag to a Zendesk ticket' with a specific verb and resource. It distinguishes from sibling tools like zendesk_remove_tag.

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?

Idempotency is mentioned, implying safe reuse, but no explicit when-to-use or when-not-to-use guidance is provided relative to sibling tools.

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/michaelrice/zendesk-mcp'

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