Skip to main content
Glama
paulieb89

PyP6Xer MCP Server

pyp6xer_relationship_analysis

Read-onlyIdempotent

Analyzes schedule relationships by type (FS, SS, FF, SF), lag/lead distribution, and identifies activities with no logic ties to improve schedule logic.

Instructions

Analyse relationship types, lag/lead distribution, and logic density.

Reports counts by type (FS/SS/FF/SF), lag distribution, and activities with no logic ties.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cache_keyNoCache key identifying the loaded XER file (set when calling pyp6xer_load_file)default
proj_idNoProject ID or short name; uses first project if omitted

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function for the pyp6xer_relationship_analysis MCP tool. It analyses relationship types (FS/SS/FF/SF), lag/lead distribution, and logic density in a loaded Primavera P6 XER schedule file.
    @mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False))
    def pyp6xer_relationship_analysis(
        cache_key: Annotated[str, Field(description="Cache key identifying the loaded XER file (set when calling pyp6xer_load_file)")] = "default",
        proj_id: Annotated[str | None, Field(description="Project ID or short name; uses first project if omitted")] = None,
        ctx: Context = None,
    ) -> str:
        """Analyse relationship types, lag/lead distribution, and logic density.
    
        Reports counts by type (FS/SS/FF/SF), lag distribution, and
        activities with no logic ties.
        """
        xer = _get_xer(ctx, cache_key)
    
        if proj_id:
            rels = _get_project(xer, proj_id).relationships
        else:
            rels = list(xer.relationships.values())
    
        type_counts: dict = {}
        lag_buckets = {"lead_<0": 0, "zero": 0, "lag_1_5": 0, "lag_6_15": 0, "lag_>15": 0}
        total_lag = 0
    
        for r in rels:
            link = r.link
            type_counts[link] = type_counts.get(link, 0) + 1
            lag = r.lag
            total_lag += lag
            if lag < 0:
                lag_buckets["lead_<0"] += 1
            elif lag == 0:
                lag_buckets["zero"] += 1
            elif lag <= 5:
                lag_buckets["lag_1_5"] += 1
            elif lag <= 15:
                lag_buckets["lag_6_15"] += 1
            else:
                lag_buckets["lag_>15"] += 1
    
        n_rels = len(rels)
        return json.dumps({
            "total_relationships": n_rels,
            "by_type": type_counts,
            "lag_distribution": lag_buckets,
            "avg_lag_days": round(total_lag / n_rels, 1) if n_rels else 0,
            "leads_present": lag_buckets["lead_<0"] > 0,
        }, indent=2)
  • server.py:1088-1088 (registration)
    Registration of the tool via the @mcp.tool decorator on the pyp6xer_relationship_analysis function.
    @mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False, idempotentHint=True, openWorldHint=False))
Behavior3/5

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

Annotations already indicate read-only, non-destructive, idempotent behavior. Description adds what outputs are produced (counts, distribution, no-tie activities) which is useful context but does not contradict annotations.

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?

Description is two sentences with the core purpose front-loaded. Every sentence adds value without redundancy or verbosity.

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?

Description covers the main analytical outputs (type counts, lag distribution, activities with no logic ties). Combined with annotations and output schema, it provides sufficient context for an agent to understand the tool's role.

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?

Input schema has 100% description coverage for both parameters (cache_key and proj_id). Description does not add further parameter details, so baseline score is appropriate.

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?

Description clearly states the tool analyzes relationship types, lag/lead distribution, and logic density. It specifies outputs like counts by type (FS/SS/FF/SF) and activities with no logic ties, making it distinct from siblings like float or health analysis.

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?

No guidance on when to use this tool versus alternatives (e.g., pyp6xer_float_analysis, pyp6xer_schedule_health_check). An agent would need to infer context from the tool name and description.

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/paulieb89/pyp6xer-mcp'

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