Skip to main content
Glama

update_schema_incremental

Incrementally update a schema by adding fields (fields_to_add — minor version bump), removing fields (fields_to_remove — major version bump; observation data preserved, snapshot-excluded until re-added), or changing the identity rule…

Instructions

Incrementally update a schema by adding fields (fields_to_add — minor version bump), removing fields (fields_to_remove — major version bump; observation data preserved, snapshot-excluded until re-added), or changing the identity rule (canonical_name_fields — major version bump). Creates a new schema version and activates it immediately, so all new data stored after this call uses the updated schema. Optionally migrates existing raw_fragments to observations for historical data backfill.

canonical_name_fields re-keys how the type derives canonical_name / identity. Rules are ordered precedence with fallback — the first rule whose fields are all present wins, e.g. [{composite:["linkedin_url"]},"email","name"] keys on linkedin_url, else email, else name. Reach for it when same-name-different-entity collisions appear (e.g. a bulk import collapses distinct people who share a name because identity resolves on name alone). The existing reducer_config is preserved automatically, so this is the safe way to re-key without a full register_schema re-supply. Applies to NEW writes only — it does not retroactively re-key existing entities, so it will not by itself merge existing duplicates. Omit to keep the current rule; pass [] to clear it (succeeds only if the schema also declares identity_opt_out). The response echoes the resolved canonical_name_fields; call describe_entity_type first to see the current rule before replacing it.

Scope: omit user_specific to write to whichever scope your schema resolves to (your user-scoped override if you have one, else global); the response's scope (and user_id when scope is user) reports what was written. Pass user_specific: true or false only to override that. migrated_existing is true only when migrate_existing actually promoted fragments; migration_result.skipped says why any did not. If entity_type is rejected by a naming guard whose message names force: true as the remedy, retry with force: true.

On ERR_SCHEMA_SCOPE_MISMATCH (only after an explicit user_specific: false, when the type has no global registry row and no code-defined baseline) an active schema exists in a different scope than the call checked (details.guard_scope vs details.found_scope). Retry without user_specific, or with user_specific matching details.found_scope. Never call register_schema for that code — a second active row for the same entity_type risks dual-active corruption (#2374/#2378).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoBypass the entity-type naming guards (forbidden test-artifact patterns and the plural-name guard) for this call only. Required when entity_type is rejected with a message naming "force: true" as the remedy — e.g. a name the plural guard misclassifies (like "hypothesis"). Does not affect any other validation.
user_idNoUser ID for user-specific schema (required if user_specific=true)
activateNoActivate schema immediately so it applies to new data (default: true). If false, schema is registered but not active.
entity_typeYesEntity type to update
fields_to_addNoFields to add to schema
user_specificNoExplicit scope override. Omit this to write to whichever scope your own read of the schema resolved (global row, or your user-scoped override if you have one) — the common case, and the safe default. Pass true to create or extend a user-specific override for you even if you currently resolve the global row. Pass false to extend the global row even if you have a user-scoped override: the new global version is built from the current global schema, never from your override; if the type has no global registry row and no code-defined baseline (but has your user-scoped schema), the call returns ERR_SCHEMA_SCOPE_MISMATCH. The response's "scope" field reports which scope was actually written.
schema_versionNoNew schema version (auto-increments if not provided)
fields_to_removeNoField names to remove from schema (triggers major version bump). Observation data is preserved; fields can be restored by re-adding them later.
migrate_existingNoMigrate existing raw_fragments to observations for historical data backfill (default: false). Note: New data automatically uses updated schema after activation, migration is only for old data. The response's "migrated_existing" reflects whether anything actually promoted, and "migration_result.skipped" names any fragment groups that did not (e.g. ambiguous ownership, already promoted by a prior call) — a request with migrate_existing: true can legitimately promote zero fragments.
canonical_name_fieldsNoReplace the entity type's identity rule (how canonical_name / entity identity is derived). Triggers a major version bump. Each item is a single field name (string) or an all-required composite ({composite:[...]}). Rules are ORDERED PRECEDENCE WITH FALLBACK: the resolver uses the first rule whose fields are all present, not an unordered set. Example: [{"composite":["linkedin_url"]},"email","name"] keys on linkedin_url when present, else email, else name. Omit to keep the current rule. Passing [] clears the rule, but only succeeds when the schema also declares identity_opt_out; otherwise it is rejected (a schema must declare canonical_name_fields OR identity_opt_out). The existing reducer_config is preserved automatically — this is the safe way to re-key a type without reconstructing it. Applies to NEW writes only; it does NOT retroactively re-key existing entities (they keep their stored canonical_name until re-derived), so re-keying will not by itself merge existing duplicates. To see the current rule before replacing it, call describe_entity_type first; the update response also echoes the resolved canonical_name_fields.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.25.0
    • addedInput schema / properties / force
      Added value: +{
      +  "default": false,
      +  "description": "Bypass the entity-type naming guards (forbidden test-artifact patterns and the plural-name guard) for this call only. Required when entity_type is rejected with a message naming \"force: true\" as the remedy — e.g. a name the plural guard misclassifies (like \"hypothesis\"). Does not affect any other validation.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / migrate_existing / description
      Previous value: -"Migrate existing raw_fragments to observations for historical data backfill (default: false). Note: New data automatically uses updated schema after activation, migration is only for old data."New value: +"Migrate existing raw_fragments to observations for historical data backfill (default: false). Note: New data automatically uses updated schema after activation, migration is only for old data. The response's \"migrated_existing\" reflects whether anything actually promoted, and \"migration_result.skipped\" names any fragment groups that did not (e.g. ambiguous ownership, already promoted by a prior call) — a request with migrate_existing: true can legitimately promote zero fragments."
    • removedInput schema / properties / user_specific / default
      Removed value: -false
    • changedInput schema / properties / user_specific / description
      Previous value: -"Create user-specific schema variant (default: false)"New value: +"Explicit scope override. Omit this to write to whichever scope your own read of the schema resolved (global row, or your user-scoped override if you have one) — the common case, and the safe default. Pass true to create or extend a user-specific override for you even if you currently resolve the global row. Pass false to extend the global row even if you have a user-scoped override: the new global version is built from the current global schema, never from your override; if the type has no global registry row and no code-defined baseline (but has your user-scoped schema), the call returns ERR_SCHEMA_SCOPE_MISMATCH. The response's \"scope\" field reports which scope was actually written."
  2. Changed1 schema field changedv0.21.0
    • addedInput schema / properties / canonical_name_fields
      Added value: +{
      +  "description": "Replace the entity type's identity rule (how canonical_name / entity identity is derived). Triggers a major version bump. Each item is a single field name (string) or an all-required composite ({composite:[...]}). Rules are ORDERED PRECEDENCE WITH FALLBACK: the resolver uses the first rule whose fields are all present, not an unordered set. Example: [{\"composite\":[\"linkedin_url\"]},\"email\",\"name\"] keys on linkedin_url when present, else email, else name. Omit to keep the current rule. Passing [] clears the rule, but only succeeds when the schema also declares identity_opt_out; otherwise it is rejected (a schema must declare canonical_name_fields OR identity_opt_out). The existing reducer_config is preserved automatically — this is the safe way to re-key a type without reconstructing it. Applies to NEW writes only; it does NOT retroactively re-key existing entities (they keep their stored canonical_name until re-derived), so re-keying will not by itself merge existing duplicates. To see the current rule before replacing it, call describe_entity_type first; the update response also echoes the resolved canonical_name_fields.",
      +  "items": {
      +    "oneOf": [
      +      {
      +        "type": "string"
      +      },
      +      {
      +        "properties": {
      +          "composite": {
      +            "items": {
      +              "type": "string"
      +            },
      +            "type": "array"
      +          }
      +        },
      +        "required": [
      +          "composite"
      +        ],
      +        "type": "object"
      +      }
      +    ]
      +  },
      +  "type": "array"
      +}
  3. Addedv0.15.0
  4. Removedv0.14.0
  5. Addedv0.12.1
  6. Removedv0.11.0
  7. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

No annotations, so the description carries the full burden and does: it discloses activation-on-create, scope resolution semantics, that canonical_name_fields applies to NEW writes only and will not merge existing duplicates, that reducer_config is preserved, the [] -clears-only-with-identity_opt_out rule, migration skipping, and the dual-active corruption risk. This is exceptional behavioral disclosure.

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?

Front-loaded and well-organized into paragraphs, but it is very long with some redundancy (user_specific is described in both the schema and the prose at length, and canonical_name_fields is restated twice). Much of it earns its place, but an agent-facing definition is denser than needed.

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

Completeness5/5

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

A complex 10-param mutation tool with no output schema and no annotations. The description covers version-bump rules, scope resolution, migration, identity re-keying, error recovery, and cross-tool prerequisites — everything an agent needs to call it correctly and interpret outcomes.

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?

With 100% schema coverage the baseline is 3, but the description adds meaning beyond the schema: it explains the ordered-precedence-with-fallback semantics of canonical_name_fields with a concrete example, the omit-vs-[] distinction, the semantics of omitting user_specific vs pass true/false, and the force-retry idiom.

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?

States a specific verb+resource (incrementally update a schema) and enumerates the three operations it performs (add fields, remove fields, change identity rule) with their version-bump consequences. It clearly distinguishes itself from sibling register_schema ('the safe way to re-key without a full register_schema re-supply').

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

Usage Guidelines5/5

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

Explicit when-to-use for canonical_name_fields ('reach for it when same-name-different-entity collisions appear'), when to call describe_entity_type first, the ERR_SCHEMA_SCOPE_MISMATCH retry path, and a hard when-NOT ('Never call register_schema for that code'). This goes well beyond the norm.

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