Skip to main content
Glama

zendesk_get_ticket

Retrieve a Zendesk ticket by ID to access fields like status, priority, requester, assignee, tags, and description.

Instructions

Get a Zendesk ticket by ID. Returns ticket fields including status, priority, requester, assignee, tags, and description.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool 'zendesk_get_ticket' is registered as an MCP tool via the @mcp.tool() decorator on line 81. The function receives a ticket_id and delegates to _get_ticket_data.
    def register_ticket_tools(mcp) -> None:
        @mcp.tool()
        def zendesk_get_ticket(ticket_id: int) -> str:
            """Get a Zendesk ticket by ID. Returns ticket fields including status, priority, requester, assignee, tags, and description."""
            return _get_ticket_data(ticket_id)
  • Core handler _get_ticket_data that fetches a Zendesk ticket by ID using the Zenpy client, formats the response into JSON with fields like id, subject, status, priority, type, requester, assignee, group, tags, dates, description, and a ticket_url.
    def _get_ticket_data(ticket_id: int) -> str:
        try:
            client = get_client()
            ticket = client.tickets(id=ticket_id)
            return json.dumps({
                "id": ticket.id,
                "subject": ticket.subject,
                "status": ticket.status,
                "priority": ticket.priority,
                "type": ticket.type,
                "requester": {
                    "name": ticket.requester.name,
                    "email": ticket.requester.email,
                },
                "assignee": {
                    "name": ticket.assignee.name,
                    "email": ticket.assignee.email,
                } if ticket.assignee else None,
                "group": ticket.group.name if ticket.group else None,
                "tags": ticket.tags,
                "created_at": str(ticket.created_at),
                "updated_at": str(ticket.updated_at),
                "description": ticket.description,
                "ticket_url": f"https://{_get_subdomain()}.zendesk.com/agent/tickets/{ticket.id}",
            }, 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}"
  • Helper function _get_subdomain() that loads the config and returns the Zendesk subdomain for building the ticket URL.
    def _get_subdomain() -> str:
        from zendesk_mcp.config import load_config
        return load_config().get("subdomain", "")
  • The get_client() helper called by _get_ticket_data to instantiate the Zenpy client using OAuth token from config.
    def get_client(config_file: Path | None = None) -> Zenpy:
        cfg = load_config(config_file)
        subdomain = cfg.get("subdomain", "").strip()
        token = cfg.get("oauth_token", "").strip()
        if not subdomain or not token:
            raise ConfigError("Zendesk not configured. Run: zendesk-mcp setup")
        return Zenpy(subdomain=subdomain, oauth_token=token)
  • The server imports register_ticket_tools and calls it in main(), which is where the tool decorator runs and registers zendesk_get_ticket with the MCP server.
    from zendesk_mcp.tools.ticket import register_ticket_tools
    from zendesk_mcp.tools.comments import register_comments_tools
    from zendesk_mcp.tools.attachments import register_attachment_tools
    from zendesk_mcp.tools.gitlab_context import register_gitlab_context_tools
    from zendesk_mcp.tools.write_comments import register_write_comment_tools
    from zendesk_mcp.tools.update_ticket import register_update_ticket_tools
    from zendesk_mcp.tools.time_tracking import register_time_tracking_tools
    from zendesk_mcp.tools.git_zen import register_git_zen_tools
    
    register_ticket_tools(mcp)
Behavior2/5

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

With no annotations provided, the description bears full responsibility for behavioral disclosure. It states the tool returns fields but does not explicitly confirm it is a read-only operation, nor does it mention error handling (e.g., what happens if the ticket ID is invalid) or any authentication requirements.

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 extremely concise—one sentence that front-loads the action and resource, then lists key return fields. No superfluous words; every phrase adds value.

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?

Given the tool's simplicity (one parameter, no nested objects) and the presence of an output schema, the description covers the essential purpose. However, it lacks context about when to use this tool over siblings or error behaviors, which slightly reduces completeness.

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?

The input schema has 0% description coverage, and the description only adds 'by ID', which minimally clarifies the ticket_id parameter. It does not explain the format, constraints, or source of the ID, leaving ambiguity for the agent.

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 verb 'Get' and the resource 'Zendesk ticket by ID', indicating a direct lookup operation. It lists the fields returned, which helps distinguish from sibling tools like search_tickets. However, it does not explicitly differentiate from other get-like siblings such as get_comments.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternative tools like zendesk_search_tickets or zendesk_get_comments. It does not specify prerequisites, such as requiring a valid ticket ID, or scenarios where this tool is preferred.

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