Skip to main content
Glama

Validate Strategy Markdown

tt_validate_markdown
Read-onlyIdempotent

Validate a strategy spec (markdown OR JSON) against the locked schema.

Auto-detects format: text starting with '{' is treated as JSON, otherwise as markdown (the Tradetron strategy-markdown grammar).

mode: 'create' (strict, for new strategies; checks int types tightly) 'update' (lenient, for already-existing strategies fetched via get_strategy where some legacy types are looser).

ALWAYS call this BEFORE create_strategy. The validator catches:

  • SCHEMA_LOCK rule violations (settings wrapper, positions vs legs, etc.)

  • Forbidden condition keys (condition_action, parent, sort, c_new)

  • Type mismatches (instrument as string, fee_frequency as 'Month', etc.)

  • Unknown keywords (typos, hallucinated function names)

  • Structural issues that TT would silently drop on submit

Returns a structured error list with hints for each issue, so you can fix the spec and retry without making a round-trip to TT.

AUTHORING RULES it enforces — follow them up front so you do not round-trip on errors:

  • Leg Qty is in LOTS; confirm the resolved lot count per leg in your summary. A count of shares/contracts mis-sizes by orders of magnitude.

  • A per-leg trailing/repair stop (Leg SL trail / Leg Exit / Traded Instrument) anchors the condition that OPENED the leg — usually cond_type='Entry', 'Repair Once' when a Repair Once opened it — never the condition it sits in (a self-reference never arms).

  • Index strikes use ATM SPOT (NIFTY/BANKNIFTY); MCX uses ATM (no spot). Weekly expiry = the 'Current Week' token, never a Week Day==N filter.

  • 'N minutes after entry' = Time Difference (T2-T1)(EntryTime( underlying), Time('NSE')) >= Number(N) (never gate on != with it); read entry price/time via the Entry* keywords, not a literal.

  • Init Var takes 2 args (name, default); Get Runtime takes 1 (name). Cross-sectional ranking (top-N) works only inside a Python block.

  • Never improvise a keyword's signature: if you are not CERTAIN of its argument count and order, call tt_lookup_keyword and copy the returned example's shape (an OHLC read is Position ( CLOSE ( Symbol ( Instrument Name ( ... ) , '5m', 'All' ) ) , '-1' ) — the candle interval lives in Symbol, never in Position). If the logic cannot be expressed from catalog-verified shapes, say so and offer the nearest construct Tradetron supports; never a nearest guess.

GAPS — the trading decisions the user never made. data.gaps lists each missing or ambiguous piece (no exit, no stop-loss on sold options, a stop-loss or target the description promises but the logic lacks, an unstated expiry or quantity, re-entry after an exit, a keyword that does not run) as {code, field, question, options: [2-4 x {label, detail, value}], default, blocking}. When gaps is non-empty, do NOT guess and do NOT ask open-ended: put each gap to the user as its question with its options, one question per gap, and mark the option whose value equals default as the usual choice (default: null = no safe default, let them pick). Settle every blocking: true gap before you create; a non-blocking gap may take its default when the user says to go ahead. Build exactly what they pick, then validate again. When the user did not state a leg's expiry or the quantity, leave that Expiry cell blank or the Qty column out instead of guessing: the conventional default is applied and the gap comes back so you can confirm it. Gaps never change valid, errors or warnings.

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": {
      "text": "<text>"
    },
    "name": "tt_validate_markdown"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNo'create' (strict — every check runs) or 'update' (lenient — checks that only apply to a fresh create are skipped). Default 'create'.create
textYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, so the description is not carrying the safety burden. It does add genuinely useful non-structured behavior: format auto-detection on leading '{', a structured error list with hints, and the important invariant that gaps never change valid/errors/warnings. However, much of the length is authoring advice rather than disclosure of this tool's own runtime behavior, so it lands at solid-but-not-exceptional.

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

Conciseness3/5

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

Purpose, mode and the before-create rule are front-loaded and well organized, but the AUTHORING RULES and GAPS blocks run long and mix authoring doctrine with validator usage. The content is useful but disproportionate to a two-parameter validation call; a significant share belongs in a schema-authoring reference rather than this tool's description.

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?

With no output schema, the description must explain return values, and it does: a structured error list with hints, plus the data.gaps shape ({code, field, question, options, default, blocking}) and the valid/errors/warnings fields. Complete enough to act on results, though it never names the top-level response shape beyond gaps.

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

Parameters4/5

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

Schema coverage is 50% and the 'text' parameter has no schema description whatsoever; the description compensates by explaining the detection rule that governs how 'text' is interpreted. The 'mode' semantics (strict vs lenient, which checks are skipped) duplicate and slightly extend the schema description, adding real meaning beyond the default value.

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: 'Validate a strategy spec (markdown OR JSON) against the locked schema', plus auto-detection behavior. An agent can distinguish this from tt_validate_python (Python blocks) and from tt_create_strategy 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?

Explicit ordering instruction ('ALWAYS call this BEFORE create_strategy') and explicit mode selection guidance ('create' strict for new strategies, 'update' lenient for strategies fetched via get_strategy). It also routes to tt_lookup_keyword when a keyword signature is uncertain, naming both the alternative and the trigger condition.

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.

Resources