Skip to main content
Glama
dev-in-black

OpenProject MCP Server

by dev-in-black

create_relation

Establish connections between work packages to define dependencies, hierarchies, or associations in OpenProject. Specify relation types like blocks, precedes, duplicates, or relates to organize task relationships.

Instructions

Create a relation between two work packages.

Args:
    from_id: Source work package ID
    to_id: Target work package ID
    relation_type: Type of relation (relates, duplicates, blocks, precedes, follows, includes, partof, requires)
    lag: Optional lag in days for precedes/follows relations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_idYes
to_idYes
relation_typeYes
lagNo

Implementation Reference

  • Core implementation of the create_relation tool, handling API call to create relation between work packages.
    async def create_relation(
        from_id: int,
        to_id: int,
        relation_type: RelationType,
        lag: int | None = None,
    ) -> dict[str, Any]:
        """Create a relation between two work packages.
    
        Args:
            from_id: Source work package ID
            to_id: Target work package ID
            relation_type: Type of relation. Options:
                - relates: General relation
                - duplicates: Source duplicates target
                - duplicated: Source is duplicated by target
                - blocks: Source blocks target
                - blocked: Source is blocked by target
                - precedes: Source precedes target (with optional lag in days)
                - follows: Source follows target (with optional lag in days)
                - includes: Source includes target (parent-child)
                - partof: Source is part of target (child-parent)
                - requires: Source requires target
                - required: Source is required by target
            lag: Optional lag in days for precedes/follows relations
    
        Returns:
            Created relation object
        """
        client = OpenProjectClient()
    
        try:
            payload: dict[str, Any] = {
                "_links": {
                    "from": build_link(f"/api/v3/work_packages/{from_id}"),
                    "to": build_link(f"/api/v3/work_packages/{to_id}"),
                },
                "type": relation_type,
            }
    
            if lag is not None:
                payload["lag"] = lag
    
            result = await client.post("relations", data=payload)
            return result
        finally:
            await client.close()
  • MCP tool registration for create_relation, which delegates to the relations module implementation.
    @mcp.tool()
    async def create_relation(
        from_id: int,
        to_id: int,
        relation_type: str,
        lag: int | None = None,
    ):
        """Create a relation between two work packages.
    
        Args:
            from_id: Source work package ID
            to_id: Target work package ID
            relation_type: Type of relation (relates, duplicates, blocks, precedes, follows, includes, partof, requires)
            lag: Optional lag in days for precedes/follows relations
        """
        return await relations.create_relation(
            from_id=from_id,
            to_id=to_id,
            relation_type=relation_type,  # type: ignore
            lag=lag,
        )
  • Type definition for valid relation_type values used in create_relation.
    RelationType = Literal[
        "relates",
        "duplicates",
        "duplicated",
        "blocks",
        "blocked",
        "precedes",
        "follows",
        "includes",
        "partof",
        "requires",
        "required",
    ]
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it's a creation operation but doesn't cover permissions needed, whether it's idempotent, error conditions, or what happens on success (e.g., returns a relation ID). The lag parameter hint for 'precedes/follows' adds some context, but overall behavioral traits are minimally described.

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 appropriately sized and front-loaded with the core purpose in the first sentence. The parameter explanations are structured clearly in a list format, with no redundant or wasted sentences. Every element earns its place by adding necessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/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 is moderately complete. It covers the purpose and parameters well but lacks behavioral details (e.g., response format, error handling) and usage context. For a mutation tool with 4 parameters, it should provide more guidance on outcomes and constraints to be fully complete.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must fully compensate. It successfully adds meaning beyond the schema by explaining each parameter: 'from_id' as source work package ID, 'to_id' as target work package ID, 'relation_type' with enumerated values, and 'lag' as optional days for specific relation types. This provides complete parameter semantics not present in the schema.

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 ('Create') and resource ('relation between two work packages'), making the purpose immediately understandable. It distinguishes from siblings like 'delete_relation' and 'get_relation' by specifying creation. However, it doesn't explicitly differentiate from other creation tools like 'create_work_package' in terms of resource type.

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 alternatives. It doesn't mention prerequisites (e.g., existing work packages), exclusions, or comparisons with siblings like 'set_parent_work_package' or 'list_work_package_relations'. Usage is implied only through the action described.

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/dev-in-black/openproject-mcp'

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