Field Meaning, Not Guesswork: Semantic Types in the CanvasXpress MCP

When an AI assistant builds a chart, the hard part is rarely picking the chart type. It is all the small presentation decisions that follow. Should a column of percentage changes use a diverging palette centered on zero, so gains and losses read as opposite directions? Should a rank column use a sequential scale in rank order? Should a percentage axis be pinned between zero and one hundred? These are not creative choices — they follow mechanically from what the column means. But if you leave them to a language model, it has to guess, and guesses have to be cleaned up afterward.

The CanvasXpress MCP server now shrinks that guessing. It understands a vocabulary of semantic types — the meaning of a field, not just its storage class — and derives the right presentation defaults deterministically from that meaning. The model decides what the chart is; a reliable, rule-based step decides how each column should look.

From coarse types to meaning

Until now the server accepted only a coarse description of each column: string, numeric, factor, or date. That tells you how to store a value, not what it represents. A column of signed numbers straddling zero could be a temperature, a profit-and-loss figure, or a change over time — and each of those wants a different presentation.

The new semantic vocabulary captures that distinction. It recognizes types like:

Crucially, the mapping is channel-aware. A rank column used for color is not the same as a rank column used as an axis, and the server only applies the color treatment when that column is actually driving color. It will not mis-apply a palette to a column sitting on an axis.

How it works in practice

Semantic types show up in two ways.

First, generate_canvasxpress_config now takes an optional semantic_types argument. Supply it, and the server merges the matching presentation fragment into the generated config. Omit it, and the server infers the types automatically — from column names (a pct_change or delta column, a rank column, a price column) and from the values themselves (numbers that all fall in zero-to-one-hundred suggest a percentage; signed values straddling zero suggest a delta; a clean run of integers one through n suggests a rank).

Second, a standalone annotate_semantic_types tool lets an assistant inspect what the server would infer before generating anything. It returns the suggested type for each column, a short rationale for why that type fired, a preview of the config fragment each would contribute, and the full supported vocabulary. So an agent can check, confirm, or override the inference up front, rather than discovering it after the fact.

The rule that keeps it safe

The merge follows one firm principle: a semantic default only fills in a config key the model left unset. It never overwrites an explicit choice. If the assistant deliberately set a palette, that palette stands. The deterministic layer fills the gaps the model did not address; it does not argue with the ones it did.

Just as important, every key a semantic type can emit is a real, verified CanvasXpress parameter. The server already strips out any configuration key that is not a genuine engine parameter — its defense against hallucinated settings — and the semantic fragments are built entirely from keys that pass that check. So the presentation defaults survive the cleanup step and actually reach your chart, rather than being quietly dropped.

Why this is the right division of labor

There is a simple insight underneath all of this: the more you can turn into a deterministic rule, the less there is for a language model to get wrong. Picking the chart type and the channel mapping is genuinely a judgment call, and that is where the model's strength lies. Deriving a diverging palette for a signed-change column, or a zero baseline for a count, is not a judgment call at all — it is a lookup. Handing those lookups to a rule-based step makes the output more consistent, more reproducible, and less dependent on how the model was feeling that run.

For you, the effect is charts that look right by default. A percentage-change column comes back with a sensible diverging palette centered on zero, and labels that make sense, without anyone having to notice that it should. A rank column reads in rank order. A percentage axis is bounded. You asked for a chart; you got one that already made the obvious presentation decisions correctly.

Getting started

If you use CanvasXpress through the MCP server, you already have this. Generate a config as usual and let the inference run, or pass semantic_types explicitly when you want to be precise. Reach for annotate_semantic_types when you want to see — and adjust — how the server reads your columns before it builds anything. Either way, field meaning now drives presentation, and the assistant is left to do what it is actually good at.