Skip to main content
Glama

Write Pine Script® with Quant

quant_generate_pine_script

Has Quant, our coding agent, write a Pine Script® v6 indicator or strategy from a prompt, or change one in place: the script passed as code, or one of the member's saved scripts by its script_id (the result then has a unified diff). Quant works in the background with the Pine Script® reference, checks every attempt with LuxAlgo's linter and fixes what fails, until the script passes or its time runs out. Returns the script, whether it passes the linter and what is still flagged. A script that passes is saved to the member's LuxAlgo account as one of their Quant scripts, where they find it in Vela: a new script, or with script_id a new version of that script; the result says which, with its script_id. One that does not pass yet is saved nowhere: call again with it as code (and the same script_id, if any) and what is left to fix as the prompt. With add_to_chart (off by default), a script that passes is also put on the chart the member has open right now in Vela, the one they used last, where they see it appear and run; a changed script that was on that chart already runs its new version in place. Set it only when the member asked to see it on their chart. To change an indicator that is on their chart, read the chart with vela_read_chart: one that is a saved script of theirs comes with its script_id. It uses the member's Quant usage on their LuxAlgo plan, metered by the LuxAlgo app. To only check a script the member already has, use quant_validate_pine_script, which uses no usage. It writes code; it never runs or backtests it, and it is not trading advice. Requires signing in with a LuxAlgo account (OAuth).

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>",
      "context": "<context>"
    },
    "name": "quant_generate_pine_script"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeNoA Pine Script® to change. Quant edits it in place instead of writing a new one.
promptYesWhat to build or change, in plain words: the logic, inputs, plots and alerts the member wants.
contextYesExplain in 15-25 words, in third person, why this tool is called and how it supports the user's goal. For analytics only. You MUST describe only the abstract purpose of the tool call. NEVER include, repeat, paraphrase, or infer personal, sensitive, or identifying information from the user request or tool results, including names, emails, phone numbers, IPs, IDs, or credentials. You MUST generalize specific entities into roles such as "a user", "the customer", or "an account". Example: "Retrieving a customer's recent orders to investigate a billing issue and help support determine the appropriate resolution."
script_idNoOne of the member's saved scripts to change, by its id from quant_search_user_scripts. Its saved source is what Quant changes unless `code` is passed too, and a result that passes is saved as its new version.
add_to_chartNoAlso put the script on the chart the member has open right now in Vela, the one they used last, once it passes and is saved. False by default: set it only when the member asked to see it on their chart.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / add_to_chart
      Added value: +{
      +  "description": "Also put the script on the chart the member has open right now in Vela, the one they used last, once it passes and is saved. False by default: set it only when the member asked to see it on their chart.",
      +  "type": "boolean"
      +}
  2. Added

TDQS

A4.5/5.0
Behavior4/5

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

Goes well beyond the annotations (readOnlyHint=false, openWorldHint=true) by disclosing that Quant works in the background, lints and retries within a time budget, and returns the script plus linter status. It also states the consequential outcomes clearly: passing scripts are saved to the member's account (new script or new version), failing scripts are 'saved nowhere,' work is metered against plan usage, OAuth is required, and it never runs or backtests. Minor gap: no statement about how long the background run typically takes or what happens on timeout beyond 'its time runs out.'

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?

Purpose is front-loaded in the first clause, and each sentence carries behavioral information. However, it is one undifferentiated ~250-word paragraph with some redundancy ('the chart the member has open right now in Vela, the one they used last' and the repeated restatement of saving behavior), which makes the save/retry/chart rules harder to scan than they need to be.

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?

This is a complex, non-idempotent, metered, authenticated write tool with no output schema, and the description still covers what it returns (script, pass/fail, remaining flags, resulting script_id), persistence rules, failure recovery, and auth requirements. An agent has everything needed to call it correctly without additional context.

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 semantics the schema lacks: the interaction between `code` and `script_id` (code wins, script_id becomes a new version), that a script_id run yields a unified diff, and the precise chart-placement behavior of `add_to_chart` including in-place replacement.

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 ('Has Quant ... write a Pine Script® v6 indicator or strategy') and covers both creation and in-place modification. It explicitly distinguishes itself from quant_validate_pine_script ('To only check a script ... which uses no usage') and points to vela_read_chart for locating a chart script's id.

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 conditions for each mode: pass `code` for a new/changed script, `script_id` for a saved script, both together for a failing retry, and `add_to_chart` only 'when the member asked to see it on their chart.' It also names the alternative (quant_validate_pine_script) and the cross-tool path (vela_read_chart) for get script_id.

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.