Skip to main content
Glama
systemsomicslab

ms-data-parser

library_plot_mirror

Read-only

Draw a mirror plot from the latest library match, comparing measured MS/MS peaks with a ranked reference and returning a PNG or coordinate payload.

Instructions

直近の library_match_feature 結果から対向プロット(mirror plot)を描く。

上段が測定、下段が参照(rank 位の候補)。output="image"(既定)は サーバ側で描画した PNG を返し、output="payload" は座標を丸めた lipidmix.mirror.v2 JSON を返す(Use-LLLM 等、自前で描くクライアント向け。 v2 で採点外ピーク unscored_mz の層を追加)。

測定側の一致色分けには許容幅(ms2_tol)が要る——library_match_feature が使った値(store の search_params か既定値)を自動で引き継ぐ。

.dbs の強度足切りで採点に入らなかった測定ピークは灰色で薄く描く (last_match["unscored_mz"] を引き継ぐ)。採点は normalize_measured が 足切りした後のスペクトルに対して行うのに、図は足切り前の生ピークを描くため、 区別が無いと「描かれているのに採点されていない」ピークが黙って混ざる。 消さずに描くのは、消すと「MS/MS が取れていない」と読めてしまうため。 この層はラベル枠を取らず、凡例と caption の件数は該当ピークがあるときだけ 出る(足切りが 0 の run では図も caption も従来と変わらない)。

scale は縦軸の写し方で "relative"(既定)/ "sqrt" / "log10"。 precursor がベースピークのスペクトル(脂質の [M-H]- など)は relative だと診断イオンが相対数 % に潰れて読めない——そのときに "sqrt" を使う。 上流 MS-DIAL も同じ問題を軸の切り替えで解いている (ObservableMsSpectrum.CreateAxisPropertySelectors2 の Relative / Absolute / Log10 / Sqrt)。Absolute は用意しない——対向プロットは単位の違う 2 つの スペクトルを上下に並べるので、生の強度で並べても比較にならない。

label_policy は m/z ラベルの衝突回避の方式。どちらも強度降順に走査して 既に置いたラベルと重なるものを飛ばす(上流 Annotator.OnRender と同じ 貪欲法)が、重なりの見方が違う:

  • "auto"(既定)— 水平と垂直の両方が近いときだけ飛ばす。箱は ラベル自身の文字列を実測する。対向プロットは同じ側でもピークの高さが 大きく違うので、2 次元で見るほうが読めるラベルを多く残せる。

  • "msdial" — 上流に忠実。水平距離だけを見て、箱は代表文字列 "1000.00000" 1 つで全ラベル共通にする。上流の MS2 ビューは Overlap="Horizontal, Direct" だが、この合成は OR で、全ラベルが同じ箱を 使うため Direct は Horizontal の部分集合になり実質 Horizontal 単独に 縮退している。縦にどれだけ離れていても m/z が近ければ飛ばすので、 "auto" よりラベルは少なくなる。

どちらも上下は別枠で数える(上流は上下で別々の Annotator を持つため、 側をまたぐ衝突は起きない)。

Input Schema

NameRequiredDescriptionDefault
rankNo
scaleNorelative
outputNo
label_policyNoauto

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

With readOnlyHint already covering safety, the description adds substantial non-obvious behavior: unscored peaks below the `.dbs` intensity cutoff are drawn faint gray rather than dropped, that layer is excluded from label slotting, and legend/caption counts appear only when such peaks exist. It also documents the greedy descending-intensity collision scan and that the payload format is `lipidmix.mirror.v2` with an added `unscored_mz` layer.

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?

Front-loaded and bolded where it matters, but over-long for a four-parameter tool: the upstream MS-DIAL digressions (CreateAxisPropertySelectors2 selectors, the `Overlap="Horizontal, Direct"` OR-degeneracy argument) are rationale that does not change how the agent calls the tool. The behavior it explains is still correct, so it is verbose rather than wasteful.

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?

No output schema, so the description supplies the return contract itself (server-rendered PNG vs. rounded-coordinate `lipidmix.mirror.v2` JSON), and it discloses the `ms2_tol` inheritance from stored `search_params`. Everything needed to call it correctly and interpret the result is present.

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?

Schema coverage is 0%, so the description carries the full burden and does: it gives the value set and default for `scale` (relative/sqrt/log10) and explains why `Absolute` is deliberately omitted, defines `label_policy` semantics ('auto' 2-D vs 'msdial' horizontal-only), and clarifies `rank` as selecting among ranked candidate references. This is meaning well beyond bare `type: integer/string`.

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 ('対向プロット(mirror plot)を描く') plus the exact data source ('直近の library_match_feature 結果'), so an agent knows both the action and its input. No sibling in the list produces mirror plots, so there is no ambiguity to resolve.

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?

Explicitly frames the two output modes: default PNG rendering on the server vs. `output="payload"` for clients that draw themselves (naming Use-LLM as the case). It also gives a concrete trigger for `scale="sqrt"` ('precursor がベースピークのスペクトル'). Missing only an explicit statement of when not to call it (e.g. no prior match result exists).

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