Skip to main content
Glama
tedorigawa001

TradingView-MCP

save_pine_script

Save Pine Script source to a TradingView library as a new script or new version, using a two-step confirm flow to preview changes before writing. Compile errors are reported with line numbers for quick fixes.

Instructions

Save Pine source to the user's script library — the ONLY write tool, with a confirm flow: without confirm=true nothing is written and a dry-run preview is returned; show it to the user and get their approval before calling again with confirm=true. Non-destructive by design: creates a new script (name, no pine_id) or a new version of an existing one (pine_id), and every older version stays retrievable via get_pine_source(pine_id, version). Compile errors are returned with line numbers; note the version is stored even if compilation fails (see revertHint). Typical PDCA loop: get_pine_source -> edit -> save_pine_script -> run_backtest.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNoScript name — required when creating a new script, optional rename otherwise
sourceYesFull Pine source, e.g. starting with //@version=5
confirmNoMust be true to actually write. Default: false = dry run only
pine_idNoExisting script to save a NEW VERSION of. Omit to create a new script

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.10

TDQS

A5/5.0
Behavior5/5

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

With no annotations present, the description carries the full burden, and it delivers: it discloses the dry-run behavior, non-destructive design, versioning semantics, compile-error reporting with line numbers, and the fact that a version is stored even on compile failure. This goes far beyond a typical tool description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but every sentence earns its place. It front-loads the single most important fact (write tool with confirm flow) and then layers mode details, versioning, error behavior, and a workflow example without unnecessary filler.

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?

Despite no output schema and no annotations, the description covers what an agent needs: the write path, the dry-run path, error behavior, version retention, and the recommended surrounding workflow. It is sufficiently complete for correct invocation and user-facing behavior.

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?

Although schema coverage is 100%, the description adds meaning above the schema: confirm defaults to false and is required for actual writes, name is needed for new scripts while pine_id targets an existing script for a new version, and older versions remain retrievable. This helps the agent understand the relationship between parameters and side effects.

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 opens with a specific verb and resource: 'Save Pine source to the user's script library.' It explicitly marks itself as 'the ONLY write tool' and distinguishes the two modes of operation (new script vs new version), making it easy to differentiate from read-oriented siblings like get_pine_source and list_pine_scripts.

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?

The confirm-flow is clearly explained: call once without confirm=true to get a dry-run preview, then call again with confirm=true only after user approval. It also gives explicit guidance on when to omit pine_id (new script) versus provide it (new version), and even provides a typical PDCA loop: get_pine_source -> edit -> save_pine_script -> run_backtest.

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

Install Server

Other Tools