Skip to main content
Glama

AI 优化策略

platform_ai_optimize
Destructive

【策略】AI 多轮优化策略(写操作,需用户确认):输入 prompt 描述策略目标,自动生成→回测→分析→改进(最多 maxRounds 轮,1-5,默认 3)。耗时较长。给了 initialCode 时第 1 轮不生成:直接回测这份既有代码作基线,第 2 轮起在其上改进(A3)。strategyParams 为指标参数覆盖(对齐 /api/cex/indicator/backtest 的 params)。context 为可选结构化学徒上下文(B2-a,失败因子/评审结论/目标指标),独立注入 LLM。每轮回传 rounds[].params(本轮实际生效参数)与 rounds[].errorCode(失败原因可判定);全轮未产出代码时返回 502/429 + errorCode,不再返回空 finalCode。(cost: ≈ 34–38 credits/轮(按实际 tokens 结算))(写操作,外部调用将以 apikey 身份直接执行)

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": {
      "prompt": "<prompt>"
    },
    "name": "platform_ai_optimize"
  }
}

Input Schema

NameRequiredDescriptionDefault
promptYes策略目标描述(必填)
contextNo可选结构化学徒上下文(B2-a):failedReasons/retiredFactors/reviewNotes/targetMetrics,独立注入 LLM,不进 prompt 文本
categoryNo分类(可选,默认 dex)
maxRoundsNo优化轮数 1-5(可选,默认 3)
initialCodeNo待改进的既有策略代码(可选;提供时第 1 轮直接回测它作基线)
backtestParamsNo回测参数(可选)
strategyParamsNo指标参数覆盖,写入引擎 indicator_params(可选)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the annotations, it discloses the cost profile (≈34-38 credits/round, metered by actual tokens), the long execution time, that external calls execute under the apikey identity, and the failure contract (502/429 + errorCode instead of an empty finalCode). It also explains the round-level return surface (rounds[].params, rounds[].errorCode), so the agent knows what a degraded run looks like. This is consistent with destructiveHint=true / readOnlyHint=false and adds material context the annotations cannot carry.

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?

The content is information-dense and front-loaded with the strategy tag, but it is one run-on block with heavy parenthetical nesting and internal codes (A3, B2-a) that mean nothing to an agent. The write-operation warning appears twice (opening tag and trailing parenthetical), and the maxRounds range/default duplicates the schema 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?

For a 7-parameter tool with nested objects and no output schema, the description covers the loop mechanics, the cost, the failure modes, and the shape of per-round results, which is enough to invoke it correctly. Gaps remain around what category selects and what backtestParams controls, but neither is central to calling the tool safely.

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 100%, so the baseline is 3, but the description adds real meaning: context is injected separately into the LLM rather than folded into prompt text, strategyParams overrides indicator params aligned to /api/cex/indicator/backtest, and initialCode changes round-1 behavior. It leaves category and backtestParams largely unelaborated beyond the schema.

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

Purpose4/5

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

The description states a concrete verb+resource: an AI multi-round optimization strategy that runs generate→backtest→analyze→improve. It also specifies the loop cap (maxRounds 1-5, default 3) and the initialCode shortcut, which separates it from a one-shot generation tool. It never explicitly names a sibling (e.g., platform_ai_generate or platform_run_backtest) as the alternative, so differentiation is implied rather than stated.

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

Usage Guidelines4/5

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

It gives usable conditions: supply prompt to describe the goal, supply initialCode when you already have code to baseline and only want improvement from round 2. It flags the write/user-confirmation requirement and the long runtime, which shape when to pick it. It stops short of saying which sibling to use instead when the user only wants a single generation or a plain backtest.

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.