Skip to main content
Glama

zendesk_list_attachments

List all attachments from a Zendesk ticket's comments. Returns filename, content type, size, and download URL for each attachment.

Instructions

List all attachments across all comments for a Zendesk ticket. Returns filename, content type, size, and download URL for each. Use zendesk_download_attachment to fetch file contents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual tool handler function 'zendesk_list_attachments' that takes a ticket_id and returns a JSON list of attachments across all comments on a Zendesk ticket.
    def zendesk_list_attachments(ticket_id: int) -> str:
        """List all attachments across all comments for a Zendesk ticket. Returns filename, content type, size, and download URL for each. Use zendesk_download_attachment to fetch file contents."""
        return _list_attachments_data(ticket_id)
  • The helper function '_list_attachments_data' that contains the core logic to fetch ticket comments, iterate over attachments, and return JSON data with comment_id, filename, content_type, size_bytes, and download_url.
    def _list_attachments_data(ticket_id: int) -> str:
        try:
            client = get_client()
            comments = client.tickets.comments(ticket_id)
            result = []
            for comment in comments:
                for att in (comment.attachments or []):
                    result.append({
                        "comment_id": comment.id,
                        "filename": att.file_name,
                        "content_type": att.content_type,
                        "size_bytes": att.size,
                        "download_url": att.content_url,
                    })
            return json.dumps(result, 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}"
  • The registration function 'register_attachment_tools' which uses @mcp.tool() decorator to register 'zendesk_list_attachments' as an MCP tool.
    def register_attachment_tools(mcp) -> None:
        @mcp.tool()
        def zendesk_list_attachments(ticket_id: int) -> str:
            """List all attachments across all comments for a Zendesk ticket. Returns filename, content type, size, and download URL for each. Use zendesk_download_attachment to fetch file contents."""
            return _list_attachments_data(ticket_id)
  • The call to 'register_attachment_tools(mcp)' in server.py's main function that triggers attachment tool registration.
    register_attachment_tools(mcp)
  • The 'get_client' helper that creates a Zendesk API client used by _list_attachments_data to fetch ticket comments.
    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)
Behavior3/5

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

Without annotations, the description only conveys the scope (lists attachments) and return types. It does not disclose other behavioral traits like safety (read-only), permissions, or performance, but is sufficient for a simple read operation.

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?

Three efficient sentences: purpose, return values, and related tool. No redundant information.

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?

The description covers what the tool does and its output, complemented by an existing output schema. Minor gap: no mention of potential limitations like pagination or large numbers of attachments.

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 description mentions 'for a Zendesk ticket', which adds context to the only parameter ticket_id. However, it does not elaborate on the parameter format or constraints beyond the self-explanatory name. Since schema coverage is 0%, the description partially compensates.

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 tool lists all attachments across all comments for a ticket, distinguishing it from siblings like zendesk_download_attachment.

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 explicitly mentions an alternative tool (zendesk_download_attachment) for fetching contents, guiding the agent on when to use each. However, it does not explicitly state when not to use this tool.

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