Skip to main content
Glama
longbridge

longbridge

Official

Quant — Run Indicator Script

quant_run
Read-onlyIdempotent

Run quant indicator scripts against historical K-line data to calculate and return indicator values as JSON. Provide symbol, date range, period, and script inputs.

Instructions

Run a quant indicator script against historical K-line data on the server. Executes the script server-side and returns the computed indicator/plot values as JSON. Periods: 1m, 5m, 15m, 30m, 1h, day, week, month, year (default: day). The optional input parameter accepts a JSON array matching the order of input.*() calls in the script, e.g. "[14,2.0]".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
_jqNoOptional jq filter (jaq syntax) applied to this tool's JSON response before it is returned; it never changes the upstream request. One output is returned as-is, several as a JSON array, none as []. Module imports and the `env`/`debug`/`stderr` builtins are unavailable. Example: .data | map({symbol}). Omit for the full response.
endYesEnd date (YYYY-MM-DD) for the K-line range
inputNoScript input values as a JSON array, e.g. "[14,2.0]". Must match the order of input.*() calls in the script.
startYesStart date (YYYY-MM-DD) for the K-line range
periodNoK-line period: 1m, 5m, 15m, 30m, 1h, day, week, month, year (default: day)day
scriptNoIndicator script source.
symbolYesSymbol in <CODE>.<MARKET> format, e.g. TSLA.US, 700.HK

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.12.0
    • addedInput schema / properties / _jq / description
      Added value: +"Optional jq filter (jaq syntax) applied to this tool's JSON response before it is returned; it never changes the upstream request. One output is returned as-is, several as a JSON array, none as []. Module imports and the `env`/`debug`/`stderr` builtins are unavailable. Example: .data | map({symbol}). Omit for the full response."
  2. Changed1 schema field changedv0.10.6
    • addedInput schema / properties / _jq
      Added value: +{
      +  "type": "string"
      +}
  3. Changed2 schema fields changedv0.7.1
    • removedInput schema / description
      Removed value: -"Parameters for running an indicator script against historical K-line data:\ntarget symbol, date range, K-line period, the script source itself, and\noptional script inputs."
    • removedInput schema / title
      Removed value: -"RunScriptParam"
  4. Addedv0.4.5
  5. Removedv0.4.0
  6. Addedv0.3.2
  7. Removedv0.3.1
  8. First observedv0.1.12

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds meaningful behavioral context beyond those: execution is server-side, the tool accepts arbitrary indicator scripts, and it returns computed values as JSON. It also clarifies that the input array must match the order of input.*() calls, which is a key runtime behavior. No contradiction with annotations.

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?

Three sentences, front-loaded with the core purpose and followed by the most important parameter formatting notes. Some redundancy exists because the period list and input example are identical to the schema descriptions, but the text remains compact and scannable without padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that accepts arbitrary scripts, the description covers the essentials: data scope, period values, input format, and return type. However, it omits details about script language/syntax, how output values map to input() calls, error behavior, or limits. With no output schema, the return description ('indicator/plot values as JSON') is sufficient but thin. Given the tool's complexity, a 3 reflects the clear gaps rather than a fully complete picture.

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

Parameters3/5

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

Schema description coverage is 100%, so the structured schema already documents every parameter. The description repeats the period list and input-array example that are already in the schema, adding no new semantic nuance beyond what the schema provides. Baseline 3 is appropriate when the schema carries the full parameter documentation.

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 states a specific verb and resource: 'Run a quant indicator script against historical K-line data on the server' and clarifies the server-side execution and JSON return. This distinguishes it clearly from sibling data-retrieval tools like candlesticks or history_candlesticks_by_date; no other sibling appears to execute user-supplied scripts.

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

Usage Guidelines2/5

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

The description explains what the tool does but never says when to choose it over alternatives or when not to use it. It does not reference siblings like candlesticks, history_candlesticks_by_date, or screener_search, leaving the agent to infer that quant_run is for custom scripted indicators. No preconditions or exclusions are given.

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

Deploy Server

Other Tools