Inicio - Documentación - POM AI - 11 MCP - Authoring tools - `pom_get_available_mergetags`: list merge tags

pom_get_available_mergetags: list merge tags

Which merge tags are valid in a template context. Merge tags are how a template pulls in dynamic values, and an invalid one fails silently — so this is the call that prevents a whole class of invisible bugs.

Arguments

Argument Required Meaning
context Yes archive, single or feed

An unrecognised context falls back to single rather than erroring, so check the context field in the response matches what you asked for.

Permissions

mcp:read and pom_theme:read, with edit_theme_options.

Note the higher bar: this is a theme permission, not a content one. A client that can edit pages cannot necessarily read merge tags.

What it returns

Field Meaning
context The resolved context
mergetags Every valid tag for it
rules The syntax rules

Each tag carries its literal tag form, its name, a description and its escaping behaviour.

The three rules it returns

Use double braces. {{tag_name}}.

Use %%…%% inside attributes for long text, quoted text, HTML fragments or nested merge tags. Double braces inside a shortcode attribute break the attribute parsing; the percent form exists for exactly that case.

Do not invent merge tags. Validate before saving.

The second rule is the one that is not guessable. An assistant will reach for {{…}} everywhere, and it will produce broken shortcode attributes.

Context matters

Each context has its own catalogue. A tag valid in a single template is not necessarily valid in an archive, and using it there is an error rather than an empty render.

Read the context you are actually building for. The three contexts are described in pom_get_template_schema.

Tags available everywhere

Some tags appear in every context, including {{icon}} for rendering an SVG icon and {{translatable_string}} for registering and rendering translatable text.

The second matters on multilingual sites: hardcoded text in a template is not translatable, and {{translatable_string}} is how you make it so.

Conditional blocks

Three control tags manage conditionals: {{if}}, {{else}} and {{/if}}.

{{if}} takes meta and value attributes:

{{if meta="meta-key" value="not_empty"}}

The validator warns when {{if}} is used without both, and errors on an unmatched {{else}} or {{/if}}, or an unclosed {{if}}. See pom_validate_template_markup.

Escaping

Each tag reports its escaping. That tells you whether the value is rendered as HTML or escaped as text — which determines whether a tag is safe to place inside an attribute, and whether HTML in the underlying value will render or display as markup.

Using it well

Get the available merge tags for the archive context and show me which ones relate to the result loop.

List the single-context merge tags with their escaping behaviour.

Before composing:

Read the template schema and the available merge tags for this context, then compose the markup and validate it before writing.

Why invalid tags are dangerous

A merge tag the theme does not recognise does not raise an error. It renders as literal text or as nothing, on every page the template covers.

That combination — silent, and multiplied across many pages — is why the validator treats an unknown merge tag as an error rather than a warning, and why this tool is worth calling every time.

Related