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 'structured_xml_tags'), supports '?demo=true' or L402 (20 sats), and returns HTTP 400 if invalid.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "task": "<task>"
    },
    "name": "compile_xml_agent_prompt"
  }
}

Input Schema

NameRequiredDescriptionDefault
taskYesRaw task instructions, persona goal, and operational constraints to compile.
prompt_styleNoStructural formatting template; defaults to 'structured_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. Changed2 schema fields changed
    • changedInput schema / properties / prompt_style / description
      Previous value: -"Structural formatting template; defaults to 'anthropic_xml_tags' when omitted."New value: +"Structural formatting template; defaults to 'structured_xml_tags' when omitted."
    • changedInput schema / properties / prompt_style / enum
      Previous value: -[
      -  "anthropic_xml_tags",
      -  "markdown_sections",
      -  "strict_json_responder"
      -]New value: +[
      +  "structured_xml_tags",
      +  "markdown_sections",
      +  "strict_json_responder"
      +]
  2. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnlyHint, idempotentHint, destructiveHint=false, openWorldHint=false), and the description layers on operational facts those annotations cannot express: statelessness, a 32 KB payload cap, 60 RPM throttling, a '?demo=true' path, L402 payment at 20 sats, and HTTP 400 on invalid input. These are exactly the constraints an agent needs before invoking, and none of them contradict the annotations.

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?

Front-loaded with the core purpose and the sibling routing before the operational metadata, and every clause carries information. It is dense though — the final sentence chains statelessness, size cap, rate limit, default, demo/payment path, and error behavior into one long run-on, which costs some scannability.

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

Completeness5/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 values need not be described, and annotations carry the safety profile; the description fills the remaining gaps — cost, quota, payload ceiling, failure mode, and default behavior. For a two-parameter idempotent compiler, nothing an agent needs in order to call it correctly is missing.

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 coverage is 100% and both parameters are self-documenting, so the baseline of 3 applies. The description restates that 'task' is accepted and that 'prompt_style' defaults to 'structured_xml_tags', which duplicates the schema rather than adding meaning — it does not explain how the three enum styles differ in output.

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 and resource: 'Compiles a raw task description into a structured XML system prompt', and even enumerates the emitted sections (<role>, <context>, <objective>, <constraints>, <workflow>, <output_format>) plus the design goal (prevent instruction drift). It explicitly separates itself from route_mcp_workflow_plan, so an agent can distinguish the two without opening either 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 a positive trigger ('Use when authoring or upgrading a system prompt for an autonomous agent or sub-agent workflow') and an explicit routing exclusion ('for mapping a task objective to a concrete sequence of MCP tool calls, use route_mcp_workflow_plan instead'). The condition that selects the sibling is named, not implied.

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.