Skip to main content
Glama

Production XML-Structured System Prompt & Guardrail Compiler

compile_xml_agent_prompt
Read-onlyIdempotent

Compiles a raw task description into a structured XML system prompt (, , , , , <output_format>) engineered to prevent instruction drift. Use when authoring or upgrading a system prompt for an autonomous agent or sub-agent workflow; for mapping a task objective to a concrete sequence of MCP tool calls, use route_mcp_workflow_plan instead. Stateless read-only edge call (max 32 KB, 60 RPM): accepts 'task' ('prompt_style' defaults to 'anthropic_xml_tags'), supports '?demo=true' or L402 (20 sats), and returns HTTP 400 if invalid.

Input Schema

NameRequiredDescriptionDefault
taskYesRaw task instructions, persona goal, and operational constraints to compile.
prompt_styleNoStructural formatting template; defaults to 'anthropic_xml_tags' when omitted.

Output Schema

NameRequiredDescriptionDefault
compiled_promptYesComplete production-grade XML-structured system prompt.
estimated_tokensYesEstimated BPE token length of the compiled prompt.
key_enhancementsYesSpecific guardrails and output contract rules injected.
optimization_scoreYesPrompt clarity and constraint-completeness score from 0 to 100.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint/destructiveHint=false, and the description adds real operational context the annotations don't carry: statelessness, a 32 KB payload cap, a 60 RPM rate limit, and a 400 response on invalid input. It loses a point because the '?demo=true or L402 (20 sats)' detail describes an HTTP transport affordance that has no corresponding schema parameter, leaving the agent unsure how to actually trigger it via this tool call.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core verb+resource is front-loaded, followed by usage routing and then operational constraints — a sensible order with no filler sentences. It is dense to the point of being crammed into three semicolon-chained clauses, which slightly hurts scanability but nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return-value detail is rightly omitted, and the safety/idempotency profile is covered by annotations. What's missing is a hint about output determinism or whether compilation quality depends on upstream model behavior — minor for a compile-and-return tool but the one gap an author would still want covered.

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

Parameters3/5

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

Schema description coverage is 100% and both parameters are already documented in the schema, including the anthropic_xml_tags default. The description restates the 'task' content and the prompt_style default but adds no syntax, size, or content-shaping guidance beyond what the schema provides, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (compiles) and resource (raw task description into an XML system prompt) and enumerates the exact output sections produced (<role>, <context>, <objective>, <constraints>, <workflow>, <output_format>). It also explicitly distinguishes itself from the nearest sibling, route_mcp_workflow_plan, so an agent can differentiate without opening a schema.

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

Usage Guidelines5/5

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

Gives an explicit trigger ('Use when authoring or upgrading a system prompt for an autonomous agent or sub-agent workflow') plus an explicit exclusion with the alternative named ('for mapping a task objective to a concrete sequence of MCP tool calls, use route_mcp_workflow_plan instead'). This is the when/when-not/alternative pattern verbatim.

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.