Skip to main content
Glama

Upsert Custom Fields

upsert_custom_fields
DestructiveIdempotent

Create or update custom field definitions by (entity, fieldName) — max 100 per call, case-insensitive match. Check for a built-in first: a custom field is plain data that reorder recommendations, purchasing, pricing, reports and fulfillment never read. Each create names a purpose and a purposeDetail (the user's reason, saved on the field). On an item, a purpose a built-in covers (reorder policy, supplier, category/brand/group, lifecycle, pricing, barcode, tracking, units, dimensions, location, components, tags, notes) is not created: the row comes back needs_review with builtInAlternatives. Show those to the user, and create the field only if they still want it, by resending the row with builtInReviewed=true. fieldName is the upsert identity and never changes once set; omit it on create to derive it from name (snake_case, matching the key the Spark app generates — an all-symbol name fails validation). A supplied fieldName must follow the same convention: lowercase letters, digits and underscores only, starting with a letter or digit. name and type are required when creating; type is IMMUTABLE on update (create a new field instead) and calculated fields cannot be authored here (web app only). Every other property is preserve-on-omit. Options for list/multilist fields are matched by supplied id first, then case-insensitive name — matched options keep their id (and every stored value pointing at it), new names get a generated id, and omitted existing options are REMOVED. itemGroupIds and isCostAttribute only apply to the item entity. validateOnly=true dry-runs every row. Partial success with per-row errors; resubmitting converges. Requires an operator (unpinned) credential — field definitions are tenant-wide schema.

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": {
      "customFields": "<customFields>"
    },
    "name": "upsert_custom_fields"
  }
}

Input Schema

NameRequiredDescriptionDefault
customFieldsYesCustom-field definition rows to create/update (max 100). entity is required per row; name, type, purpose and purposeDetail are required when creating.
validateOnlyNotrue = dry-run: validate + probe every row and report the would-be action per row, writing nothing.

Output Schema

NameRequiredDescriptionDefault
rowsNo
totalNo
failedNo
createdNo
updatedNo
uomsCreatedNo
validateOnlyNo
enabledCustomersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and idempotentHint=true, and the description explains concretely what is destructive: omitted existing options are REMOVED, while matched options keep their ids and referencing values. It also discloses the immutable type, per-row partial success with convergence on resubmit, max 100 rows, and the operator (unpinned) credential requirement — behavior the annotations cannot express.

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-loading is good — the identity, the 100-row cap and the built-in gate land in the first two sentences. But the body is a dense block, and the thirteen-purpose enumeration duplicates the purpose enum already documented in the schema, costing space without adding meaning.

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?

For a destructive, tenant-wide schema mutation, the definition covers everything an agent needs: prerequisites (built-in review, operator credential), dry-run via validateOnly, immutability rules, and the per-row error model. An output schema exists, so the absence of return-value detail is not a gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3 and the description earns one extra point for cross-parameter meaning the schema does not carry: the create-vs-update requirement split, preserve-on-omit applied uniformly, and the entity/fieldName pair framing identity. Much of the fieldName and options text restates the schema descriptions verbatim, which caps this below 5.

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?

Opens with a precise verb and resource plus the upsert identity: 'Create or update custom field definitions by (entity, fieldName)'. The scope and key are unambiguous, but the description never distinguishes this from the sibling save_custom_field, so an agent cannot route between the two on the text alone.

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

Usage Guidelines4/5

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

Gives strong conditional guidance inside the workflow: 'Check for a built-in first', and an explicit when-not — a purpose a built-in covers 'is not created'. It also states the escalation path (builtInReviewed=true only after the user has seen the alternative). It stops short of naming any sibling tool as an alternative, which is why this is a 4 rather than a 5.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources