Skip to main content
Glama

zendesk_get_git_zen_links

Retrieve linked GitLab issues, merge requests, and commits for a Zendesk ticket. Returns structured lists with state, labels, weight, and direct GitLab links.

Instructions

Get linked GitLab issues, merge requests, and commits for a Zendesk ticket via the Git-Zen integration. Returns structured lists with state, labels, weight, and direct GitLab links.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ticket_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler that is exposed as 'zendesk_get_git_zen_links'. It takes a ticket_id and delegates to _get_git_zen_links_data.
    def zendesk_get_git_zen_links(ticket_id: int) -> str:
        """Get linked GitLab issues, merge requests, and commits for a Zendesk ticket via the Git-Zen integration. Returns structured lists with state, labels, weight, and direct GitLab links."""
        return _get_git_zen_links_data(ticket_id)
  • The core implementation function that fetches the Zendesk ticket, reads the Git-Zen custom field, and parses linked issues, merge requests, and commits into a structured JSON response.
    def _get_git_zen_links_data(ticket_id: int) -> str:
        field_id = load_config().get("git_zen_field_id")
        if field_id is None:
            return _NOT_CONFIGURED_MESSAGE
    
        try:
            client = get_client()
            ticket = client.tickets(id=ticket_id)
            raw = None
            for f in (ticket.custom_fields or []):
                if f['id'] == field_id and f['value']:
                    raw = f['value']
                    break
    
            if not raw:
                return json.dumps({
                    "ticket_id": ticket_id,
                    "linked_issues": [],
                    "linked_mrs": [],
                    "linked_commits": [],
                }, indent=2)
    
            data = json.loads(raw)
    
            issues = []
            for group in data.get('issueGroup', []):
                for issue in group.get('issues', []):
                    issues.append({
                        "project": f"{group['owner']}/{group['name']}",
                        "number": issue['number'],
                        "title": issue['name'],
                        "link": issue['link'],
                        "state": issue['state'],
                        "labels": [lbl['name'] for lbl in issue.get('labels', [])],
                        "weight": issue.get('weight'),
                        "milestone": issue.get('milestone'),
                    })
    
            mrs = []
            for group in data.get('fileGroup', []):
                for mr in group.get('files', []):
                    mrs.append({
                        "project": f"{group.get('owner', '')}/{group.get('name', '')}",
                        "number": mr.get('number', ''),
                        "title": mr.get('name', ''),
                        "link": mr.get('link', ''),
                        "state": mr.get('state', ''),
                    })
    
            commits = []
            for group in data.get('commitGroup', []):
                for commit in group.get('commits', []):
                    commits.append({
                        "project": f"{group.get('owner', '')}/{group.get('name', '')}",
                        "sha": commit.get('id', ''),
                        "message": commit.get('message', ''),
                        "link": commit.get('url', ''),
                    })
    
            return json.dumps({
                "ticket_id": ticket_id,
                "linked_issues": issues,
                "linked_mrs": mrs,
                "linked_commits": commits,
            }, 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}"
  • Import of register_git_zen_tools from git_zen module.
    from zendesk_mcp.tools.git_zen import register_git_zen_tools
    from zendesk_mcp.tools.create_ticket import register_create_ticket_tools
    from zendesk_mcp.tools.list_tickets import register_list_tickets_tools
    from zendesk_mcp.tools.knowledge_base import register_knowledge_base_resource
    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)
  • Registration call: register_git_zen_tools(mcp) wires the tool into the MCP server.
    register_git_zen_tools(mcp)
  • The output JSON structure returned by the tool, containing ticket_id, linked_issues, linked_mrs, and linked_commits.
    return json.dumps({
        "ticket_id": ticket_id,
        "linked_issues": issues,
        "linked_mrs": mrs,
        "linked_commits": commits,
    }, indent=2)
Behavior3/5

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

No annotations are provided, so the description must convey behavioral traits. It clearly describes a read operation returning structured lists. However, it lacks details about prerequisites (e.g., ticket must have Git-Zen links), error handling, or authentication needs.

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 two sentences with no extraneous information. It is front-loaded with the action and resource, making it efficient for an agent to parse.

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 single parameter, presence of output schema, and no annotations, the description covers the core functionality. It could mention that the tool is only relevant for tickets with Git-Zen integration or include example usage, but it is sufficient for a simple retrieval tool.

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 one required parameter (ticket_id) with no description (schema coverage 0%). The tool description does not explain the parameter, leaving the agent to infer from the name. While 'ticket_id' is obvious, the description adds no value beyond the schema.

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 it gets linked GitLab issues, merge requests, and commits for a Zendesk ticket, specifying the integration (Git-Zen) and what is returned (state, labels, weight, links). This distinguishes it from sibling tools like zendesk_get_ticket or zendesk_ticket_to_gitlab_context.

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 implies usage for Zendesk tickets with Git-Zen integration but does not explicitly state when to use this tool versus alternatives like zendesk_ticket_to_gitlab_context. No when-not-to-use guidance is provided.

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