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; merge dimensions, times, measures, and entities, or rewrite the model with replace and report dropped fields.

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): its columns are ordinary dimensions; time.fill and every time bucket use the implicit Gregorian calendar. calendar: false reverts that. On a regular model, calendar_id binds its times to a calendar; a non-default calendar is refused in this release. Fields merge into an existing model. An existing dimension, time or measure given only label, description, synonyms or meta keeps its other fields; given anything else it is rewritten, and dropped_fields lists what that drops. replace: true rewrites the model from the arguments, keeping only its id, entities, calendar_id, zero_through (how far its tables are loaded) and one_per_key, and lists what it drops in dropped_fields. one_per_key: true reads a relation whose rows repeat the key as one row per primary_key, each column the key's one value (NULL where its rows disagree); keep the columns that vary on a row-grain model of the same relation. primary_key [] makes a row-grain model (no key); entities ({parent: {} or {expr: column}}) merges the model's parent entities. Relationships also go through upsert_relationship.

Input Schema

NameRequiredDescriptionDefault
groupNocore
labelNo
timesNo
dry_runNo
replaceNo
calendarNo
entitiesNo
measuresNo
model_idYes
relationYes
dimensionsNo
entity_keyYes
calendar_idNo
descriptionNo
full_reportNotrue: the whole report (default: a summary; see its report field)
one_per_keyNo
primary_keyYes
project_pathYes
idempotency_keyYes
expected_revisionYes

Output Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changedv0.3.2
    • addedInput schema / properties / entities
      Added value: +{
      +  "anyOf": [
      +    {
      +      "additionalProperties": true,
      +      "type": "object"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedInput schema / properties / full_report
      Added value: +{
      +  "default": false,
      +  "description": "true: the whole report (default: a summary; see its report field)",
      +  "type": "boolean"
      +}
    • removedInput schema / properties / joins
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "additionalProperties": true,
      -      "type": "object"
      -    },
      -    {
      -      "type": "null"
      -    }
      -  ],
      -  "default": null
      -}
    • addedInput schema / properties / one_per_key
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null
      +}
    • addedOutput schema / $defs / ArchitectFileChange / properties / diff_truncated
      Added value: +{
      +  "default": false,
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / route_changes
      Added value: +{
      +  "items": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / route_decisions_added
      Added value: +{
      +  "items": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "type": "array"
      +}
  2. 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"
  3. First observedv0.2.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, so the baseline is lower. The description adds rich behavioral detail beyond annotations: how replace rewrites a model and lists dropped_fields, how merge semantics preserve other fields, how calendar behaves, and that a non-default calendar is refused in this release.

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

Conciseness3/5

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

The description is front-loaded with the core purpose and every clause adds semantic detail, with no obvious filler. However, it is a single dense, run-on paragraph that is difficult to scan, especially for a tool with 20 parameters.

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?

An output schema exists, so return values need not be explained, and annotations cover the safety profile. Still, for a complex upsert tool with 20 parameters and only 5% schema description coverage, the description is incomplete because it omits semantics for several required parameters and operational fields.

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 only 5%, so the description must carry the parameter burden. It explains the most ambiguous optional parameters (calendar, replace, one_per_key, primary_key, entities) well, but leaves many required and operational parameters unexplained, including project_path, model_id, entity_key, relation, expected_revision, idempotency_key, dry_run, and group.

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 opens with a specific verb+resource: 'Upsert a model and its graph entity.' It also differentiates scope from the related sibling by stating 'Relationships also go through upsert_relationship.' An agent can identify the tool's core purpose immediately.

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

Usage Guidelines3/5

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

The description implies use through the verb 'upsert' and gives substantial parameter behavior, but it does not explicitly state when to choose this tool over other upsert or model-related siblings. The only routing guidance is 'Relationships also go through upsert_relationship,' which is useful but limited to one alternative.

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