Skip to main content
Glama
harshil1502

tradingview-mcp

by harshil1502

pine_save

Save and commit the current Pine Script indicator, then reload it on the chart with one action.

Instructions

Save the current Pine script (commits + reloads the indicator on the chart).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The pineSave function is the actual handler. It accepts an empty input object, calls page.savePine() on the TradingView page, and returns {ok: true}. On failure, it throws a ToolExecutionError with the name 'pine_save'.
    // -----------------------------------------------------------------------------
    // pine_save
    // -----------------------------------------------------------------------------
    
    export const pineSaveInput = z.object({}).strict();
    export const pineSaveOutput = z.object({ ok: z.literal(true) });
    
    export async function pineSave(
      _input: z.infer<typeof pineSaveInput>,
      page: TradingViewPage,
    ): Promise<z.infer<typeof pineSaveOutput>> {
      try {
        await page.savePine();
        return { ok: true };
      } catch (cause) {
        throw new ToolExecutionError(
          'pine_save',
          'Failed to save Pine script.',
          cause,
        );
      }
    }
  • Zod schema definitions for pine_save: pineSaveInput (empty object, strict) and pineSaveOutput ({ok: z.literal(true)}).
    export const pineSaveInput = z.object({}).strict();
    export const pineSaveOutput = z.object({ ok: z.literal(true) });
  • Registration of the 'pine_save' tool in the TOOLS array with name, description, input/output schemas, and handler reference.
    {
      name: 'pine_save',
      description:
        'Save the current Pine script (commits + reloads the indicator on the chart).',
      input: pineSaveInput,
      output: pineSaveOutput,
      handler: pineSave,
    },
  • Import re-export of pineSave, pineSaveInput, pineSaveOutput from pine.ts into the tools index for registration.
    pineSave,
    pineSaveInput,
    pineSaveOutput,
Behavior3/5

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

The description discloses that the tool commits and reloads the indicator, which implies it modifies state and may have side effects on the chart. However, without annotations, it does not fully detail what happens to unsaved changes, whether it overwrites previous versions, or if it requires specific permissions. The disclosed behavior is helpful but incomplete.

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 a single, concise sentence that immediately conveys the core action. It is front-loaded with the verb 'save' and includes essential behavioral details parenthetically. No extraneous words or repetition.

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?

Given that there are no parameters, no output schema, and no annotations, the description provides a reasonable overview of the tool's function. However, it lacks details on return values, error conditions, and what 'current Pine script' refers to (e.g., the script in the editor). It is mostly complete for a zero-parameter tool but could elaborate on state implications.

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?

The input schema has no parameters, so the description does not need to add parameter semantics. The baseline for 0 parameters is 4, and the description appropriately avoids unnecessary detail.

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 clearly states the tool saves the current Pine script, with the specific actions of committing and reloading the indicator. The verb 'save' and resource 'Pine script' are precise, and the detail 'commits + reloads' differentiates it from siblings like pine_compile (which only compiles) or pine_set_source (which sets source but may not commit).

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?

No guidance is provided on when to use this tool versus alternatives such as pine_compile or pine_set_source. The description does not mention prerequisites, ordering, or scenarios where saving might be inappropriate (e.g., if the script has errors).

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/harshil1502/tradingview-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server