Skip to main content
Glama
K4L-EL

pyon-mcp

by K4L-EL

Optimize strategy (2-D parameter sweep)

optimize_strategy

Run a 2-D parameter sweep over two strategy node config fields, backtesting a grid of combinations to find the settings with the highest Sharpe ratio.

Instructions

Run a 2-D parameter sweep over two numeric config fields of a strategy's nodes, backtesting a steps x steps grid of value combinations; waits up to 600s. Use this after a strategy already trades sensibly (verify with run_backtest) to tune thresholds, periods, or sizes. Call get_strategy FIRST to obtain the exact node ids and config field names, and get_capabilities to keep the bounds inside the indicator's real range (sweeping an RSI threshold from 80 to 140 wastes half the grid on cells that can never fire). Parameters: strategyId (UUID, required); xNodeId and xField, yNodeId and yField (strings from get_strategy, required) - the two axes must not be the same node id AND field; xMin/xMax and yMin/yMax (finite numbers, required) with xMax > xMin and yMax > yMin - the steps values are spaced linearly and include both endpoints (xMin 10, xMax 30, steps 5 tests 10, 15, 20, 25, 30); steps (whole number 3 to 10, default 5); timeframe: one of 1m, 5m, 15m, 1h, 1d - optional override, defaults to what the server picks. Returns the best cell (highest sharpe, preferring cells that actually traded), the strategy's current cell, the sharpe grid as compact rows of numbers (rows = y values top to bottom, columns = x values left to right), the sweep window and timeframe, and a verbatim warning when every cell produced zero trades. If the wait times out, the error includes a jobId to check with get_job_status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xMaxYesHighest x value to test. Must be strictly greater than xMin.
xMinYesLowest x value to test. Must be strictly less than xMax.
yMaxYesHighest y value to test. Must be strictly greater than yMin.
yMinYesLowest y value to test. Must be strictly less than yMax.
stepsNoGrid resolution per axis; steps x steps backtests are run. Whole number 3 to 10, default 5.
xFieldYesNumeric config field on the x node, e.g. 'period' or 'threshold'.
yFieldYesNumeric config field on the y node. Must differ from xField when yNodeId equals xNodeId.
xNodeIdYesNode id whose config field varies along the x axis. Exactly as returned by get_strategy.
yNodeIdYesNode id whose config field varies along the y axis. May be the same node as xNodeId.
timeframeNoOptional bar timeframe override: one of 1m, 5m, 15m, 1h, 1d (lowercase). Defaults to what the server picks for the strategy.
strategyIdYesStrategy UUID. Find it with list_strategies (it is also returned by create_strategy). Not a strategy name.
Behavior5/5

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

With no annotations provided, the description carries full burden and excels: it discloses the 600s wait, timeout error with jobId, grid orientation, the 'preferring cells that actually traded' tie-break, and the verbatim zero-trade warning. It also explains default timeframe behavior.

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

Conciseness5/5

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

The description is dense and front-loaded, stating the core purpose first, then prerequisites, parameter rules, return values, and error handling. Every sentence adds operational value with no filler or repetition of schema text.

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?

For an 11-parameter, long-running optimization tool with no output schema, this description is thorough: it covers requirements, edge cases (zero trades), result contents, timeout behavior, and related tool calls. It leaves little room for misinterpretation or missing steps.

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

Parameters5/5

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

Although schema coverage is 100%, the description adds substantial meaning: it explains the axis constraint (must not be same node id AND field), linear endpoint-inclusive spacing with a concrete example, bounds strictness (xMax > xMin), steps range/default, and how to source node ids/fields from get_strategy. This goes well beyond the schema.

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?

The description names the specific action ('Run a 2-D parameter sweep'), the target resource (a strategy's nodes), and the method (backtests a steps x steps grid). It clearly distinguishes this from siblings like run_backtest by framing it as a tuning tool to use after a strategy is sensible.

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?

Explicitly states when to use ('Use this after a strategy already trades sensibly'), prereqs (call get_strategy first, get_capabilities for bounds), and even warns against nonsensical ranges. It names alternative/companion tools (run_backtest, get_strategy, get_capabilities, get_job_status) and gives concrete conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/K4L-EL/pyon-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server