Skip to main content
Glama
semantic-rails

Semantic Rails MCP Server

Official

upsert_model

DestructiveIdempotent

Create or update a semantic model and its graph entity, merging fields or replacing entirely, with optional calendar binding for time dimensions.

Instructions

Upsert a model and its graph entity. calendar: true makes it the package calendar for calendar_id (default "default", which a package with calendars needs): time.fill reads its date_day time and week_start, month_start, quarter_start and year_start kind: date dimensions. calendar: false reverts that. On a regular model, calendar_id binds its times to a calendar. Fields merge into an existing model; replace: true rewrites it from the arguments, keeping only its id, entities and calendar_id, and lists what it drops in dropped_fields.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
groupNocore
joinsNo
labelNo
timesNo
dry_runNo
replaceNo
calendarNo
measuresNo
model_idYes
relationYes
dimensionsNo
entity_keyYes
calendar_idNo
descriptionNo
primary_keyYes
project_pathYes
idempotency_keyYes
expected_revisionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
errorNo
parseNo
errorsNo
statusYes
changesYes
dry_runYes
revisionYes
project_pathYes
base_revisionYes
changed_filesYes
workspace_rootNo
idempotency_keyYes
current_revisionYes
expected_revisionYes
idempotent_replayYes
proposed_revisionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed50 schema fields changedv0.3.1
    • addedInput schema / properties / calendar
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / calendar_id
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
    • removedInput schema / properties / description / title
      Removed value: -"Description"
    • removedInput schema / properties / dimensions / title
      Removed value: -"Dimensions"
    • removedInput schema / properties / dry_run / title
      Removed value: -"Dry Run"
    • removedInput schema / properties / entity_key / title
      Removed value: -"Entity Key"
    • removedInput schema / properties / expected_revision / title
      Removed value: -"Expected Revision"
    • removedInput schema / properties / group / title
      Removed value: -"Group"
    • removedInput schema / properties / idempotency_key / title
      Removed value: -"Idempotency Key"
    • removedInput schema / properties / joins / title
      Removed value: -"Joins"
    • addedInput schema / properties / label
      Added value: +{
      +  "default": "",
      +  "type": "string"
      +}
    • removedInput schema / properties / measures / title
      Removed value: -"Measures"
    • removedInput schema / properties / model_id / title
      Removed value: -"Model Id"
    • removedInput schema / properties / primary_key / title
      Removed value: -"Primary Key"
    • removedInput schema / properties / project_path / title
      Removed value: -"Project Path"
    • removedInput schema / properties / relation / title
      Removed value: -"Relation"
    • addedInput schema / properties / replace
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
    • removedInput schema / properties / times / title
      Removed value: -"Times"
    • removedInput schema / title
      Removed value: -"upsert_modelArguments"
    • removedOutput schema / $defs / ArchitectFileChange / properties / after_bytes / title
      Removed value: -"After Bytes"
    • removedOutput schema / $defs / ArchitectFileChange / properties / after_sha256 / title
      Removed value: -"After Sha256"
    • removedOutput schema / $defs / ArchitectFileChange / properties / before_bytes / title
      Removed value: -"Before Bytes"
    • removedOutput schema / $defs / ArchitectFileChange / properties / before_sha256 / title
      Removed value: -"Before Sha256"
    • removedOutput schema / $defs / ArchitectFileChange / properties / content_encoding / title
      Removed value: -"Content Encoding"
    • removedOutput schema / $defs / ArchitectFileChange / properties / diff / title
      Removed value: -"Diff"
    • removedOutput schema / $defs / ArchitectFileChange / properties / operation / title
      Removed value: -"Operation"
    • removedOutput schema / $defs / ArchitectFileChange / properties / path / title
      Removed value: -"Path"
    • removedOutput schema / $defs / ArchitectFileChange / properties / proposed_content / title
      Removed value: -"Proposed Content"
    • removedOutput schema / $defs / ArchitectFileChange / title
      Removed value: -"ArchitectFileChange"
    • removedOutput schema / $defs / ArchitectMutationIssue / properties / code / title
      Removed value: -"Code"
    • removedOutput schema / $defs / ArchitectMutationIssue / properties / details / title
      Removed value: -"Details"
    • removedOutput schema / $defs / ArchitectMutationIssue / properties / message / title
      Removed value: -"Message"
    • removedOutput schema / $defs / ArchitectMutationIssue / title
      Removed value: -"ArchitectMutationIssue"
    • removedOutput schema / properties / base_revision / title
      Removed value: -"Base Revision"
    • removedOutput schema / properties / changed_files / title
      Removed value: -"Changed Files"
    • removedOutput schema / properties / changes / title
      Removed value: -"Changes"
    • removedOutput schema / properties / current_revision / title
      Removed value: -"Current Revision"
    • removedOutput schema / properties / dry_run / title
      Removed value: -"Dry Run"
    • removedOutput schema / properties / errors / title
      Removed value: -"Errors"
    • removedOutput schema / properties / expected_revision / title
      Removed value: -"Expected Revision"
    • removedOutput schema / properties / idempotency_key / title
      Removed value: -"Idempotency Key"
    • removedOutput schema / properties / idempotent_replay / title
      Removed value: -"Idempotent Replay"
    • removedOutput schema / properties / ok / title
      Removed value: -"Ok"
    • removedOutput schema / properties / parse / title
      Removed value: -"Parse"
    • removedOutput schema / properties / project_path / title
      Removed value: -"Project Path"
    • removedOutput schema / properties / proposed_revision / title
      Removed value: -"Proposed Revision"
    • removedOutput schema / properties / revision / title
      Removed value: -"Revision"
    • removedOutput schema / properties / status / title
      Removed value: -"Status"
    • removedOutput schema / properties / workspace_root / title
      Removed value: -"Workspace Root"
    • removedOutput schema / title
      Removed value: -"ArchitectMutationResult"
  2. First observedv0.2.0

TDQS

C2.9/5.0
Behavior4/5

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

Beyond the annotations, the description usefully explains merge vs. replace behavior, that replace keeps only id, entities, and calendar_id, and that dropped fields are returned in dropped_fields. It also discloses calendar-related state changes. This aligns with the destructiveHint and idempotentHint annotations, so there is no contradiction.

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

Conciseness2/5

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

The description is dense and run-on, with parenthetical asides and unexplained jargon such as 'time.fill' and 'kind: date dimensions.' The most important behavioral distinction (merge vs. replace) is buried near the end rather than front-loaded in a scannable structure.

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 destructive 18-parameter mutation tool with zero schema descriptions, this is incomplete. It covers calendar and replace behavior but omits semantics for required fields, prerequisites, and concurrency/revision expectations. The presence of an output schema lowers the need to describe return values, but the operational gaps remain significant.

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?

Schema description coverage is 0%, so the description must carry the parameter-semantics burden, but it only meaningfully explains calendar and replace. Most of the 18 parameters, including required ones like relation, primary_key, expected_revision, and idempotency_key, are left unexplained. The phrase 'default "default"' conflicts with the schema's calendar_id default of "", and 'time.fill' is ambiguous.

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 opens with a clear verb and resource: 'Upsert a model and its graph entity,' and the title narrows it to a semantic model. This broadly distinguishes it from sibling upsert_* tools by object type, but it never explicitly names an alternative or clarifies the graph-entity concept.

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?

There is no guidance on when to choose this tool over upsert_metric, upsert_relationship, or upsert_segment, and no exclusion criteria. The 'model' wording implies the target resource, but the description provides no explicit when-to-use or when-not-to-use context.

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