patterns_update_definition expects.
What a pattern is
A pattern is the extraction definition behind a canvas. It tells Capsulate:- which messages are relevant
- which entity type to produce
- which fields to extract
- how entities should be consolidated
- created together with a canvas via
canvas_create_with_pattern - edited later via
patterns_update_definition - inspected via
patterns_list,fetch,search, andrecords_schema
User-managed research fields
External assistants should add fields throughcanvas_column_preview / canvas_column_apply
when those tools are deployed. The saved field is user-managed, so email extraction leaves its
value alone. Columns belong to the pattern: inspect all affected Canvases before applying a
preview. Use finding contribution tools to attach external evidence and reviewed values; editing
data_points alone does not publish findings. See MCP Tools for availability and
supported scalar types.
Pattern updates validate the caller’s definition. Eligible state values with missing semantic
badge tones may use Capsulate’s low-cost model for tone classification.
Core fields
A persisted pattern definition includes these main fields:namedescriptionentity_typekeywordsdata_pointssearch_filtersllm_descriptiondistinct_fieldsautomatic_consolidationconsolidation_primary_strategyconsolidation_hintsis_active
confidence_threshold is an entity-query filter, not persisted pattern configuration, so
patterns_update_definition does not accept it.
Minimal useful pattern
At minimum, a valid pattern needs:- at least one
keyword - an
entity_type - at least one
data_point
data_points
data_points defines the extracted fields for the entity type.
Each item is an object with:
namerequiredidoptionaltypeoptional, defaults totextdescriptionoptionalroleoptionalallowedValuesoptionalrequiredoptional
Normalization rules
When you update a pattern throughpatterns_update_definition, Capsulate normalizes the definition before saving it.
String cleanup
- Empty strings are treated as missing.
name,description, andllm_descriptionare trimmed.
entity_type
entity_type is normalized into a stable field-safe identifier:
- lowercased
- non-alphanumeric characters become
_ - leading/trailing
_are removed
keywords
Keywords are:
- trimmed
- deduplicated case-insensitively
- kept in first-seen order
data_points.id
If a data point does not include id, Capsulate derives one from the provided id or name.
Example:
data_points.id as an immutable storage and binding key.
Changing data_points.name changes only the display name; it does not change what the field means
or migrate stored entity values. To track different information, add a new data point ID and retire
the old field. Existing entity data remains preserved when a field is retired. A field cannot be
removed while a Canvas dashboard widget still binds to it; update the widget specification first.
distinct_fields
distinct_fields is normalized to a deduplicated list of field IDs.
Example:
distinct_field must reference an existing data_points[].id.
Recommended field authoring
For best results, define fields as if they were a stable public schema:- keep
idvalues short, stable, and machine-friendly - make
namehuman-readable - add
descriptionwhen the field meaning is not obvious - use
allowedValuesfor status-like or category-like fields - keep most fields optional unless they are truly mandatory for the record
role
role helps clarify how a field behaves in the record:
identity: identifies the real-world itemstate: expected to change over timedescriptive: contextual information
identity:tracking_number,order_id,account_idstate:status,delivery_date,renewal_datedescriptive:merchant,category,amount
identity sparingly. Most fields are descriptive.
Consolidation fields
These fields control how Capsulate groups or deduplicates entities:distinct_fieldsautomatic_consolidationconsolidation_primary_strategyconsolidation_hints
- if
distinct_fieldsis empty andautomatic_consolidationis still enabled, the update may still succeed with a warning
search_filters
search_filters narrows which messages are considered for the pattern.
Common fields include:
exclude_sentexclude_spamexclude_promotionalexclude_archivedhas_attachmentssender_patternsexclude_domainsfrom_emaildomainsubjectcategoriesdate_fromdate_to
llm_description
llm_description is the pattern’s natural-language relevance guide.
Good descriptions are explicit about:
- what should be included
- what should be excluded
- the difference between real target emails and nearby noise
Validation behavior
patterns_update_definition returns one of two outcomes:
Valid update
- the normalized pattern is persisted
- response includes:
patternvalidationnormalized_pattern
Invalid update
- nothing is persisted
- response includes:
errorswarningssummarynormalized_pattern
Common validation failures
Typical failures include:nameis emptyentity_typeis emptykeywordsis empty after trimmingdata_pointsis not an arraydata_points[].nameis missing- duplicate data point IDs
distinct_fieldsreferences a field that does not existdistinct_fieldspoints at a display name instead of a field ID after normalization
Example deterministic update
MCP guidance
Use this pattern workflow:patterns_listorsearch(type="pattern")fetch(pattern:...)records_schemato inspect observed field coveragepatterns_update_definitionwith deterministic editspatterns_statusto inspect extraction status afterward
canvas_create_with_pattern rather than trying to treat pattern creation as a standalone user flow.
