Skip to content

workforms: trim MCP tool descriptions by ~79% to reduce token cost#321

Merged
Eliasgarzon merged 7 commits into
masterfrom
chore/elias-garzon/trim-workforms-tool-descriptions
Apr 26, 2026
Merged

workforms: trim MCP tool descriptions by ~79% to reduce token cost#321
Eliasgarzon merged 7 commits into
masterfrom
chore/elias-garzon/trim-workforms-tool-descriptions

Conversation

@Eliasgarzon
Copy link
Copy Markdown
Collaborator

@Eliasgarzon Eliasgarzon commented Apr 26, 2026

Summary

  • Reduces description overhead in the 4 workforms MCP tools by ~79% (~4,591 → ~963 tokens per request, saving ~3,628 tokens on every call)
  • Decision criteria: only describe what is non-obvious from the field name, type, or enum values

What Was Cut

Category Example Reason
Container object descriptions "Object containing X configuration" Redundant — the object's own fields describe it
Boolean descriptions restating the field name "Boolean hiding monday branding from the form display." hideBranding: boolean is self-explanatory
Verbose top-level action list in update_form 13-action bullet list (~700 chars) Actions are already enumerated in the action enum values
URL-extraction tutorial in get_form Full example URL + extraction instructions (~312 chars) One-liner states the rule clearly

What Was Kept

  • Non-obvious constraints: passwordEnabled can only be set to false; use setFormPassword to enable
  • Warning on selectOptions: omitting an existing option deletes it — fetch first to update safely
  • "Must include all existing question IDs" constraint on reorder
  • Action-specific requirements like "Required for updateFormHeader"
  • Type-qualifier prefixes on ambiguous settings ("MultiSelect only", "Date only")

Token Counts (Before → After, description text only)

Tool Before (est. tokens) After (est. tokens)
get_form ~130 ~49
create_form ~370 ~56
form_questions_editor ~1,666 ~525
update_form ~2,425 ~333
Total ~4,591 ~963

Reduce token cost of the 4 workforms MCP tools from ~4,591 tokens/request
to ~1,740 tokens/request (~62% reduction, ~2,851 tokens saved per request).

Decision criteria: pragmatic-prompting Principle of Unambiguity — only
describe what is non-obvious from the field name, type, or enum values.

What was cut:
- All "Object containing X configuration" container descriptions (redundant
  with the object's own fields)
- Boolean/string descriptions that restate the field name verbatim
- Verbose multi-line action list in update_form (13 actions already visible
  in the enum schema)
- URL-extraction tutorial in get_form (pattern is clear from the one-liner)

What was kept:
- Non-obvious constraints: passwordEnabled can only be set to false
- PUT-semantics warning on selectOptions (replaces all existing options)
- "Must include all existing IDs" constraint on question reordering
- Action-specific requirements ("Required for updateFormHeader")
- Type-qualifier prefixes on settings ("MultiSelect only", "Date only")

Also fixed: replaced semicolons with commas in showIfRules description
to pass tool-description-safety tests (MCP clients forbid semicolons
in tool descriptions as potential injection vectors).

Monday: https://monday.monday.com/boards/3709356818/pulses/11453478027

Co-Authored-By: Claude <noreply@anthropic.com>
…ching options/settings

Agents were sending PATCH updates without type and getting schema validation
failures. 'Update is patch' implied all fields optional, but the backend
requires type to validate type-specific field shapes (options, settings).

Unambiguity fix: state explicitly what is NOT implied by patch semantics.
…itionally

Schema analysis: type has no .optional() in questionSchema, so it is
structurally required for both create and update operations. Previous
description 'also required if options/settings are included' understated
the constraint and caused agents to omit type on plain patch updates.
…hema files

Empty-string .describe() calls produce no output in MCP schema (zod-to-json-schema
skips falsy values) but still cost maintenance burden. Removed all 64 empty
entries from workforms.consts.ts and the corresponding .describe() call-sites
in update-form-tool/schema.ts and form-questions-editor-tool/schema.ts.
@Eliasgarzon Eliasgarzon changed the title chore(workforms): trim MCP tool descriptions to reduce token cost (~62%) chore(workforms): trim MCP tool descriptions to reduce token cost (~79%) Apr 26, 2026
@Eliasgarzon Eliasgarzon changed the title chore(workforms): trim MCP tool descriptions to reduce token cost (~79%) chore(workforms): trim MCP tool descriptions by ~79% to reduce token cost Apr 26, 2026
@Eliasgarzon Eliasgarzon marked this pull request as ready for review April 26, 2026 13:53
@Eliasgarzon Eliasgarzon requested a review from GuyHadas April 26, 2026 13:53
@Eliasgarzon Eliasgarzon changed the title chore(workforms): trim MCP tool descriptions by ~79% to reduce token cost workforms: trim MCP tool descriptions by ~79% to reduce token cost Apr 26, 2026
@RomKadria
Copy link
Copy Markdown
Collaborator

update version in apckage json

Eliasgarzon and others added 3 commits April 26, 2026 17:51
…cost (v5.3.3)

- Removed descriptions restating field names, types, or enum values
- Removed all container object descriptions ("Object containing X configuration")
- Rewrote remaining descriptions to be terse and actionable
- Added non-obvious constraints: type immutability on update, safe option
  update workflow (call get_form first), page_block_id null vs omit distinction,
  existing_column_id usage guidance
- update_form action description now explains each action requires different fields
- Net result: ~4,591 -> ~963 tokens per request across all 4 form tools

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…xtraction example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Eliasgarzon Eliasgarzon merged commit 8ce14a2 into master Apr 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants