Skip to main content
Glama

pine_set_source

Inject or replace Pine Script source code in the active TradingView Monaco editor. Use it to deploy new scripts, apply fixes, or load templates when the Pine Editor panel is open.

Instructions

Inject Pine Script source code directly into the active Monaco editor model. WHEN TO USE: Call when deploying new Pine Script code, applying bug fixes, or loading templates. SIDE EFFECTS: STATE_MUTATING (Replaces entire Monaco editor text buffer). LIMITATIONS: Requires Pine Editor panel to be open.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesPine Script source code to inject

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well: it declares STATE_MUTATING, warns that the entire Monaco text buffer is replaced, and notes the Pine Editor panel must be open. It omits whether the buffer change is persisted (vs. needing pine_save) or whether it is undoable, leaving a minor gap.

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?

Four labeled, front-loaded clauses with zero filler; purpose, usage, side effects, and limitations each earn their place and are easy to scan.

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

Completeness4/5

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

For a one-parameter mutation tool with no annotations and no output schema, the description covers purpose, trigger scenarios, mutation semantics, and a precondition. It could still mention the downstream relationship to pine_compile/pine_save, which is the main thing an agent must know after injecting.

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% for the single 'source' parameter, so the schema already documents its meaning. The description's phrase 'Pine Script source code to inject' adds no syntax or format detail beyond the schema, so the baseline 3 applies.

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+resource ('Inject Pine Script source code directly into the active Monaco editor model') and clearly distinguishes itself from siblings such as pine_get_source, pine_save, and pine_compile. An agent can tell what this does and where it writes without opening the schema.

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?

The 'WHEN TO USE' line names concrete scenarios (deploying new code, applying bug fixes, loading templates). It doesn't name alternatives (e.g., pine_new for a blank script) or exclusions, so it falls short of the 5-level routing guidance.

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