Skip to main content
Glama

Optimize Track Order

am_optimize_order
Read-onlyIdempotent

Reorder tracks or playlist sections to avoid adjacent slow songs, small tempo shifts, and simultaneous tempo/key similarity, returning a suggested order without modifying Apple Music playlists.

Instructions

Optionally refine local audio transitions after the LLM has selected the songs and narrative blocks. By default it does not impose a global narrative arc or tempo curve; pass a named arc only when the user explicitly requests that preset. It returns an order without writing and must not choose songs or judge theme fit. / 中文:为一批曲目算出更好的顺序。这是本项目唯一会排序的工具——am_analyze_flow 只诊断(告诉你哪里有 2 处慢歌相邻、形状是 Icarus),不提供修法。这里用模拟退火处理四条相邻硬规则(不要两首慢歌相邻 / 不要「只慢一点」/ 相邻不该在 tempo 与 key 上同时相似 / 不要 BPM 无理由大跳、能量骤变)。默认不拟合全局叙事弧;只有显式传入 arc 才套用一个命名预设。只读:只返回建议顺序,不动任何歌单;把返回列表按原顺序交给 am_create_playlist 即可。因为需要每首的 BPM/调性,首次会联网抓特征(之后走缓存)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
arcNo可选的全局叙事弧预设。省略时不强加叙事形状,只优化局部衔接;仅当用户明确要求某个命名曲线时才选择,例如 cinderella(起-落-起)。
isrcsNotracks/blocks 是否按 ISRC 精确匹配,默认 false
blocksNo分组排序:每个子数组是一个乐章/段落,**段落之间的先后顺序保持不动**,只在段落内部重排。想保留叙事结构时用它(与 tracks 二选一)
tracksNo要排序的曲目,每项 '歌名 - 艺人'(配 isrcs=true 时填 ISRC)
refreshNo忽略音频特征缓存重抓,默认 false
playlistNo要重排的现有歌单名或 p.xxxx ID(与 tracks/blocks 二选一)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.5.0
    • changedInput schema / properties / arc / description
      Previous value: -"目标叙事弧,默认 man-in-a-hole(先落再起)。用 cinderella 表示起-落-起,等等"New value: +"可选的全局叙事弧预设。省略时不强加叙事形状,只优化局部衔接;仅当用户明确要求某个命名曲线时才选择,例如 cinderella(起-落-起)。"
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations' readOnly/idempotent profile, the description discloses the algorithmic approach (simulated annealing over four named adjacent-transition rules), the default behavior of not fitting a global arc, the read-only output contract (returns an order without writing), and network/caching behavior (first call fetches audio features online, then cached). These are behavior traits the annotations cannot convey.

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?

The English opening is well front-loaded and every sentence carries information. The bilingual duplication roughly doubles the length for no additional semantic content, which is the main structural cost; otherwise there is little waste.

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 a 6-parameter, no-output-schema tool, the description covers purpose, default vs. opt-in behavior, constraints, the return contract, and a first-call latency caveat. Nothing an agent needs to invoke it correctly or hand off its result is missing.

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 description coverage is 100%, so the baseline is 3. The description adds meaning on top: it clarifies that `arc` is opt-in and only applied when the user explicitly requests a preset, and it explains the `blocks` grouping semantics (inter-section order preserved, only intra-section reordered) and the tracks/blocks/playlist mutual exclusion.

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 (recompute/optimize the order of a track batch) and explicitly positions itself as 'the only ordering tool in the project', naming am_analyze_flow as the diagnosis-only sibling. An agent can distinguish it from both am_analyze_flow and am_create_playlist without opening any 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 explicit when-to-use (after songs and narrative blocks are chosen), when-not (must not choose songs or judge theme fit), a conditional rule (pass `arc` only when the user explicitly requests a named preset), and the downstream handoff (pass the returned list to am_create_playlist). The contrast with am_analyze_flow is spelled out rather than implied.

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