Skip to main content
Glama

model_upsert_relationship

Create or update a table relationship in definition/relationships.tmdl. Define fact-to-dimension columns, cardinality, and filter direction to keep Power BI models consistent.

Instructions

Create or update a relationship between two tables in definition/relationships.tmdl.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "projectPath": "<projectPath>",
      "fromTable": "<fromTable>",
      "fromColumn": "<fromColumn>",
      "toTable": "<toTable>",
      "toColumn": "<toColumn>"
    },
    "name": "model_upsert_relationship"
  }
}

Input Schema

NameRequiredDescriptionDefault
toTableYesOne-side (dimension) table name
isActiveNoWhether relationship is active (default: true)
toColumnYesOne-side column name
fromTableYesMany-side (fact) table name
fromColumnYesMany-side column name
projectPathYesPath to the .pbip file or project root folder
toCardinalityNo
fromCardinalityNo
crossFilteringBehaviorNoCross-filter direction (default: oneDirection)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full behavioral burden. It implies a mutation and some idempotent 'upsert' semantics, but does not disclose what happens when a relationship already exists (overwrite? match by which keys?), required permissions, validation behavior, or whether invalid cardinality/column combinations are rejected. The file target is helpful but not enough for a 9-parameter mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single sentence is front-loaded with the action and resource and contains no filler. It is efficient, though perhaps overly terse for a complex upsert operation.

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

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 9-parameter mutation tool with no annotations and no output schema, the description is too thin. It should explain return behavior, idempotency/overwrite semantics, validation rules, and how the upsert identifies an existing relationship, none of which are covered.

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?

Schema description coverage is 78%, so most parameters (fromTable, fromColumn, toTable, toColumn, projectPath, isActive, crossFilteringBehavior) are already documented in the schema. The description adds no additional meaning, and the two cardinality parameters (fromCardinality, toCardinality) remain undocumented beyond their enums. A baseline 3 is appropriate given the moderate coverage.

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 states a specific verb pair ('Create or update') and resource ('a relationship between two tables') plus the target file ('definition/relationships.tmdl'). It is clearly distinguishable from model_delete_relationship, though it does not explicitly name that sibling or contrast the upsert behavior with deletion.

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?

It gives no when-to-use guidance: no mention of prerequisites (e.g., both tables must exist), no condition for preferring create vs update, and no pointer to model_delete_relationship for removal. The only implied usage is that it manages relationships rather than tables or measures.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.