| validate_strategyB | Validate a strategy directory against echolon contracts. Args:
path: Absolute path to the strategy directory.
Returns a dict with keys: status ("VALID"|"INVALID"), errors (list of dicts).
|
| get_error_docA | Fetch the structured error documentation for a given error code. ``what`` and ``why`` come from the in-memory registry
(``echolon.errors.ERROR_CATALOG``); the long-form sections (``fix``,
``example``, ``common_causes``, ``related``) come from the per-code
markdown at ``echolon/native/errors/codes/{code}.md``. The full
markdown body is also returned as ``long_form_markdown`` so an
agent can consume the prose verbatim if the parsed sections are
empty (parser-resilience fallback).
Args:
code: Error code like 'VAL-001' or 'IND-003'.
|
| list_indicatorsA | Return all indicator names in the echolon catalog, optionally filtered by lookback semantics. Args:
has_lookback: Optional filter.
``True`` → only indicators with a period-like parameter
(e.g. RSI, ATR — sweepable single-dim lookback).
``False`` → only indicators without a period parameter
(no-param indicators like OBV, multi-param scalar indicators
like BBANDS, special-config indicators).
Omit for all.
|
| indicator_infoB | Return structured info for one indicator, or None if unknown. Keys: ``name``, ``has_lookback``, ``function``, ``file``, ``params``
(list of ``{name, default, type}`` dicts). Column names emitted at
runtime by ``processor._build_suffix`` (handles multi-param sweeps).
|
| indicator_paramsA | Return the tunable parameters for an indicator, or None if unknown. Convenience accessor — same as ``indicator_info(name)["params"]`` but
skips the wrapper dict. Each entry is ``{"name": str, "default": any, "type": str}``.
|
| validate_indicator_listA | Validate a flat-dict strategy_indicator_list.json payload against the catalog. Args:
payload_json: JSON string of the flat-dict
(e.g. ``'{"rsi": {"timeperiod": [10, 20]}}'``).
Returns a dict ``{"valid": bool, "errors": [{code, field, message, suggestion}]}``.
Bad JSON surfaces as a structured error, not a raise.
|
| suggest_similarA | Return up to limit catalog names close to name (difflib + substring). |
| scaffold_componentA | Write a framework-correct scaffold for a strategy component file. Produces a minimal stub that matches echolon's loader contract —
class name + method signature + return schema — but contains no
trading logic. Coding agents refine the stub into real pathways.
Args:
kind: One of ``"entry"``, ``"exit"``, ``"risk"``, ``"sizer"``, ``"strategy"``.
strategy_dir: Absolute path to the directory where the file is written.
force: If True, overwrite an existing file. If False (default), refuse
and return ``success=False`` with ``error="file_exists"``.
Returns:
{
"success": bool,
"output_path": str (path to the scaffolded file, if success),
"kind": str (echoes the input),
"error": str | None (one of: "unknown_kind", "file_exists", None),
"message": str (human-readable summary),
}
|
| validate_debug_completionA | Validate post-run debug artifacts landed on disk with the right shape. Three deterministic checks:
- STR-001: ``selected_robust_trial.json`` + log file both exist.
- VAL-003: artifact JSON parses and carries every required top-level key.
- BT-010: log contains each required marker substring (order irrelevant).
Args:
artifact_path: Absolute path to the JSON artifact (typically
``<workspace>/backtest/selected_robust_trial.json``).
log_path: Absolute path to the debug log file.
required_json_keys: Top-level keys expected on the artifact.
Defaults to ``["trial_number", "params", "metrics"]``.
required_log_markers: Substrings expected in the log. Defaults
to ``["STAGE 4 COMPLETE", "STAGE 5 COMPLETE", "FINAL SUCCESS"]``.
Returns ``{"any_errors": bool, "findings": [{"code", "message",
"context"}, ...]}``. Never raises — parse / file-access failures
surface as findings with the appropriate error code.
|
| validate_component_protocol_signaturesA | AST-check that each required component class has the required
method with a matching return-type annotation (if annotated at all). - STR-003: class is missing the required method.
- VAL-006: method declares a return annotation but it doesn't match
the expected BaseModel (EntrySignalOutput / ExitSignalOutput / ...).
Missing annotations are NOT flagged (policy vs correctness — missing
annotation is a stylistic choice, Pydantic catches runtime
mismatches). Missing files are silently skipped (preflight STR-001
territory).
Returns ``{"any_errors": bool, "findings": [...]}``.
|
| validate_component_integrationA | Import each component module via StrategyLoader and check its
method arity + strategy_params.DEFAULT_PARAMS top-level shape. - STR-002: module fails to import (= guaranteed runtime failure).
- PRM-002: DEFAULT_PARAMS missing a required top-level key, or a
value isn't a dict.
- VAL-005: method's required-positional arity (after ``self``)
doesn't match the protocol. Arg NAMES are not checked — the
framework calls positionally, so names are the author's choice.
Returns ``{"any_errors": bool, "findings": [...]}``.
|
| validate_component_loggingB | AST-check that each component's required method calls the
matching self.log_<component>_output(...) with a BaseModel
instance (not a dict, not a wrong schema). Also flags ``self.params.get(...)`` anywhere in the file (PRM-004 —
defensive dict-access antipattern on the params container).
Returns ``{"any_errors": bool, "findings": [...]}``.
|
| describe_component_apiA | Return the live BaseComponent + IMarketData API surface. Use this BEFORE writing any component code. The return value is
produced via ``inspect.signature()`` on the actual classes, so it
always reflects the current echolon version — there is no skill /
doc drift. If a method appears here, it exists; if it doesn't, it
doesn't. Pip-install or editable-install, same answer.
Returns a dict with shape::
{
"BaseComponent": {
"override_methods": [{"name": ..., "signature": ..., "doc": ...}, ...],
"helper_methods": [{...}, ...],
"properties": [{"name": ..., "doc": ...}, ...],
},
"IMarketData": {
"methods": [{"name": ..., "signature": ..., "doc": ...}, ...],
},
}
``override_methods`` are the four BaseComponent stubs each component
file must override (``generate_signal`` / ``should_exit`` /
``can_trade`` / ``calculate_size``). ``helper_methods`` are concrete
helpers strategies may call (``get_current_bar``, ``get_indicator``,
``log_*_output``, etc.). ``properties`` are read-only attribute
accessors (``self.market_data``, ``self.portfolio``, ``self.params``).
``signature`` is the formatted ``inspect.Signature`` (e.g.
``"(self, name: str, index: int = 0) -> float"``). ``doc`` is the
first line of the docstring; full docstrings live on the source.
|
| validate_parameter_accessA | AST-check for hardcoded threshold literals (PRM-003) and defensive
self.params.get() calls (PRM-004) across the 4 component files. Highest FP-risk of the B1 validators — PRM-003 findings include
``context["severity"] = "warning"`` so callers can treat them as
non-blocking while the allowlist is tuned. PRM-004 findings are
always bugs (framework contract violation).
Allowlist covers: range() args, index slicing, keyword args, default
args, None comparisons, small integer constants ``{-1, 0, 1, -1.0, 0.0, 1.0}``,
and string-literal comparisons (framework-defined regime / signal enums).
Returns ``{"any_errors": bool, "findings": [...]}``.
|
| generate_strategy_paramsA | Generate strategy_params.py from params_to_optimize.json. Deterministic code generation: parses the JSON → determines parameter
ownership across components → emits ComponentParameterTemplate classes
+ framework registration + optuna_search_space with crossover
constraints → writes the target file. Period parameters that exceed
the frequency-appropriate indicator cap are auto-clamped and reported.
Args:
params_file_path: Absolute path to ``params_to_optimize.json``.
output_path: Absolute path to write ``strategy_params.py``.
frequency: ``"interday"`` (caps: TEMA≤62, ADX≤93, default≤180)
or ``"intraday"`` (caps: TEMA≤500, ADX≤750, default≤1000).
Returns ``{"success": bool, "output_path": str, "corrections":
[{"param", "type", "old_*", "new_*", "cap", "category", "changes"?}],
"message": str}``. Parse / IO failures surface as
``success=False`` rather than raising.
|
| list_patternsA | Return all canonical pattern names. |
| get_patternB | Return a pattern's structured content, or None if unknown. |
| list_templatesA | Return all shipped strategy template names. |
| load_templateC | Load a template's files. Returns {'name': ..., 'files': {filename: content}}. |
| list_skillsA | Return all in-package skills as [{name, description}]. Each skill is one ``SKILL.md`` packet under
``echolon/native/skills/echolon_api/<name>/``. Description comes
from the YAML frontmatter ``description:`` field. Use this as a
directory of "what doctrine is available" before calling
``get_skill(name)`` for the body.
|
| get_skillA | Return one skill's body, or None if unknown. Returns ``{name, description, body, body_no_frontmatter}``.
``body`` is the full file (including YAML frontmatter); use
``body_no_frontmatter`` for the prose alone.
|
| get_docA | Read any markdown file under echolon/native/ and return its body. Generic fallback for content not covered by the dedicated tools
(``get_pattern``, ``get_skill``, ``get_error_doc``, ``load_template``).
Useful for skill-cross-reference resolution and supplementary files
(``echolon/native/skills/SKILLS.md``,
``echolon/native/errors/codes/README.md``, template READMEs).
Args:
path: Relative path under ``echolon/native/`` (e.g.
``"skills/SKILLS.md"``, ``"errors/codes/README.md"``,
``"templates/minimal/README.md"``). Absolute paths and
paths escaping the package root are refused with
``error="path_outside_native"``.
Returns ``{path, body}`` on success, or
``{error, message, path}`` on failure (path-traversal attempt,
file not found, not a markdown file).
|
| validate_strategy_fullA | Run every shipped validator and return merged findings. Composes the individual MCP validators (``validate_strategy`` /
``validate_component_protocol_signatures`` /
``validate_component_integration`` / ``validate_component_logging``
/ ``validate_parameter_access``) so an agent gets a complete
validation report from a single tool call.
Args:
strategy_dir: Absolute path to the strategy directory.
Returns:
``{status, any_errors, total_findings, findings: [{code, ...}],
invocations: [{validator, count}]}``. ``status`` is ``"VALID"``
iff no findings were reported by any validator.
|