Skip to main content
Glama
Vortiago
by Vortiago

add_parent_child_link

Establish hierarchical relationships between work items to organize epics, features, user stories, and tasks for structured work breakdown and progress tracking.

Instructions

    Adds a parent-child relationship between two work items.
    
    Use this tool when you need to:
    - Establish hierarchy between work items
    - Organize epics, features, user stories, and tasks
    - Create a structured breakdown of work
    - Enable rollup of effort and progress tracking
    
    IMPORTANT: The child work item will immediately appear under the parent
    in hierarchical views. This relationship affects how the items are
    displayed in backlogs and boards. In Azure DevOps, a work item can have
    only one parent but multiple children.
    
    Args:
        parent_id: ID of the parent work item
        child_id: ID of the child work item
        project: Optional project name or ID
        
    Returns:
        Formatted string containing the updated child work item details
        showing the new parent relationship, formatted as markdown
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parent_idYes
child_idYes
projectNo

Implementation Reference

  • The handler and registration for the 'add_parent_child_link' MCP tool. It takes parent_id and child_id, retrieves the work item client, and calls the helper _add_link_to_work_item_impl to add a 'System.LinkTypes.Hierarchy-Reverse' relation from child to parent on the child work item.
    @mcp.tool()
    def add_parent_child_link(
        parent_id: int,
        child_id: int,
        project: Optional[str] = None,
    ) -> str:
        """
        Adds a parent-child relationship between two work items.
        
        Use this tool when you need to:
        - Establish hierarchy between work items
        - Organize epics, features, user stories, and tasks
        - Create a structured breakdown of work
        - Enable rollup of effort and progress tracking
        
        IMPORTANT: The child work item will immediately appear under the parent
        in hierarchical views. This relationship affects how the items are
        displayed in backlogs and boards. In Azure DevOps, a work item can have
        only one parent but multiple children.
        
        Args:
            parent_id: ID of the parent work item
            child_id: ID of the child work item
            project: Optional project name or ID
            
        Returns:
            Formatted string containing the updated child work item details
            showing the new parent relationship, formatted as markdown
        """
        try:
            wit_client = get_work_item_client()
            
            return _add_link_to_work_item_impl(
                source_id=child_id,
                target_id=parent_id,
                link_type="System.LinkTypes.Hierarchy-Reverse",
                wit_client=wit_client,
                project=project
            )
            
        except AzureDevOpsClientError as e:
            return f"Error: {str(e)}"
        except Exception as e:
            return f"Error creating parent-child link: {str(e)}"
  • Core helper function that implements adding a link to a work item by building a JsonPatchOperation to add a relation and updating the work item via the Azure DevOps client.
    def _add_link_to_work_item_impl(
        source_id: int,
        target_id: int,
        link_type: str,
        wit_client: WorkItemTrackingClient,
        project: Optional[str] = None,
    ) -> str:
        """
        Implementation of adding a link between work items.
        
        Args:
            source_id: ID of the source work item
            target_id: ID of the target work item
            link_type: Type of link to create
            wit_client: Work item tracking client
            project: Optional project name or ID
            
        Returns:
            Formatted string containing the updated work item details
        """
        # Get organization URL from environment
        org_url = _get_organization_url()
        
        # Build link document with the full URL
        link_document = _build_link_document(target_id, link_type, org_url)
        
        # Update the work item to add the link
        updated_work_item = wit_client.update_work_item(
            document=link_document,
            id=source_id,
            project=project
        )
        
        return format_work_item(updated_work_item)
  • Helper function that constructs the JsonPatchOperation document specifically for adding a relation link to a work item.
    def _build_link_document(target_id: int, link_type: str, org_url: str) -> list:
        """
        Build a document for creating a link between work items.
        
        Args:
            target_id: ID of the target work item to link to
            link_type: Type of link to create
            org_url: Base organization URL
            
        Returns:
            List of JsonPatchOperation objects
        """
        return [
            JsonPatchOperation(
                op="add",
                path="/relations/-",
                value={
                    "rel": link_type,
                    "url": f"{org_url}/_apis/wit/workItems/{target_id}"
                }
            )
        ]
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it explains the immediate effect ('child work item will immediately appear under the parent'), impact on views ('affects how items are displayed in backlogs and boards'), and system constraints ('a work item can have only one parent but multiple children'). It also mentions the return format. However, it lacks details on error conditions or permissions required.

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 well-structured with clear sections (purpose, usage guidelines, important notes, args, returns). Each sentence adds value: the opening statement defines the tool, bullet points clarify usage, the IMPORTANT section explains behavior, and parameter/return details are concise. No wasted words.

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 no annotations and no output schema, the description does a strong job covering purpose, usage, behavior, and parameters. It explains the return value as a formatted string. However, for a mutation tool with system constraints, it could benefit from mentioning error cases or authentication needs, keeping it from a perfect score.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It provides clear semantics for all three parameters: 'parent_id' and 'child_id' are described as IDs of work items, and 'project' is noted as optional with name or ID. This adds meaningful context beyond the bare schema, though it doesn't specify format details for 'project'.

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 ('Adds a parent-child relationship between two work items') and distinguishes it from siblings like 'create_work_item' or 'update_work_item' by focusing on establishing hierarchy rather than creating or modifying individual items. The verb 'adds' and resource 'relationship between two work items' are precise.

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

Usage Guidelines5/5

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

The description explicitly lists four use cases (e.g., 'Establish hierarchy between work items', 'Organize epics, features, user stories, and tasks') and provides context on when to use it. It also implicitly distinguishes from siblings by focusing on relationship management rather than data retrieval or modification of individual items.

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/Vortiago/mcp-azure-devops'

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