Skip to main content
Glama

list_docs

Read-onlyIdempotent

List all available Pine Script v6 documentation files with descriptions, organized by category. Use to select a file for further reading.

Instructions

List all available Pine Script v6 documentation files with descriptions.

Returns files organised by category with descriptions. For small files use get_doc(path). For large files (ta.md, strategy.md, collections.md, drawing.md, general.md) use list_sections(path) then get_section(path, header).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_docs' tool. It is decorated with @mcp.tool() and uses the _timed_tool context manager. It iterates over the DOCS dictionary (lines 180-222), categories each doc by path prefix, and returns a formatted markdown list of all available documentation files grouped by category (Concepts, Reference, Functions, Visuals, Writing Scripts, Migration).
    @mcp.tool(
        tags={"reference", "discovery"},
        annotations={"readOnlyHint": True, "idempotentHint": True, "openWorldHint": False}
    )
    async def list_docs():
        """List all available Pine Script v6 documentation files with descriptions.
    
        Returns files organised by category with descriptions.
        For small files use get_doc(path). For large files
        (ta.md, strategy.md, collections.md, drawing.md, general.md)
        use list_sections(path) then get_section(path, header).
        """
        with _timed_tool("list_docs"):
            output = ["# Pine Script v6 Documentation", ""]
    
            categories = {
                "Concepts": [],
                "Reference": [],
                "Functions": [],
                "Visuals": [],
                "Writing Scripts": [],
                "Migration": [],
            }
    
            for path, desc in DOCS.items():
                if path.startswith("concepts/"):
                    categories["Concepts"].append((path, desc))
                elif path.startswith("reference/functions/"):
                    categories["Functions"].append((path, desc))
                elif "migration" in path:
                    categories["Migration"].append((path, desc))
                elif path.startswith("reference/"):
                    categories["Reference"].append((path, desc))
                elif path.startswith("visuals/"):
                    categories["Visuals"].append((path, desc))
                elif path.startswith("writing_scripts/"):
                    categories["Writing Scripts"].append((path, desc))
    
            for category, docs in categories.items():
                if docs:
                    output.append(f"## {category}")
                    for path, desc in docs:
                        output.append(f"- `{path}`: {desc}")
                    output.append("")
    
            return "\n".join(output)
  • The tool decorator defines the schema: tags indicate 'reference' and 'discovery' categories, and annotations mark the tool as read-only (safe), idempotent (safe to retry), and not open-world (no external side effects). The function takes no parameters and returns a string.
    @mcp.tool(
        tags={"reference", "discovery"},
        annotations={"readOnlyHint": True, "idempotentHint": True, "openWorldHint": False}
    )
  • The tool is registered via the @mcp.tool() decorator on line 387, which registers the async function 'list_docs' as an MCP tool on the FastMCP server instance.
    @mcp.tool(
        tags={"reference", "discovery"},
        annotations={"readOnlyHint": True, "idempotentHint": True, "openWorldHint": False}
    )
  • The DOCS dictionary (lines 180-222) is the data source used by list_docs(). Each key is a file path and each value is a description. The handler iterates over this dictionary to build the categorized listing.
    DOCS = {
        # Concepts
        "concepts/execution_model.md": "Bar-by-bar execution, var, varip, history vs realtime",
        "concepts/timeframes.md": "Multi-timeframe data, request.security, repainting prevention",
        "concepts/colors_and_display.md": "Colors, gradients, transparency, color.new, bgcolor",
        "concepts/common_errors.md": "Runtime and compile-time error explanations",
        "concepts/methods.md": "User-defined methods, method declarations, extending types",
        "concepts/objects.md": "User-defined types (UDT), type keyword, object-oriented patterns",
        # Reference
        "reference/variables.md": "Built-in variables: open, high, low, close, volume, syminfo",
        "reference/constants.md": "Fixed constants: color.red, shape.*, plot.style_*, size.*",
        "reference/types.md": "Type system: int, float, bool, series, simple, const",
        "reference/keywords.md": "Language keywords: if, else, for, while, var, varip, switch",
        "reference/operators.md": "Arithmetic, comparison, logical, ternary operators",
        "reference/annotations.md": "Library annotations: @description, @function, @param, @returns, export",
        "reference/pine_v6_cheatsheet.md": "Compact v6 reference with common pitfalls",
        # Functions
        "reference/functions/ta.md": "Technical analysis: ta.rsi, ta.sma, ta.ema, ta.macd, ta.crossover",
        "reference/functions/strategy.md": "Backtesting: strategy.entry, strategy.exit, strategy.close",
        "reference/functions/request.md": "External data: request.security, request.financial",
        "reference/functions/drawing.md": "Visuals: plot, plotshape, line.new, box.new, label.new, table",
        "reference/functions/collections.md": "Arrays, maps, matrices: array.new, map.new, matrix.new",
        "reference/functions/general.md": "Math, strings, inputs: math.abs, str.format, input.int",
        # Visuals
        "visuals/overview.md": "Visual outputs overview, chart graphics concepts",
        "visuals/plots.md": "plot(), plotcandle(), plotbar() functions",
        "visuals/backgrounds.md": "bgcolor(), background coloring techniques",
        "visuals/bar_coloring.md": "barcolor(), coloring price bars",
        "visuals/bar_plotting.md": "plotcandle(), plotbar() for custom OHLC",
        "visuals/colors.md": "Color functions, color.new(), color.rgb()",
        "visuals/fills.md": "fill() between plots and hlines",
        "visuals/levels.md": "hline(), horizontal levels",
        "visuals/lines_and_boxes.md": "line.new(), box.new() drawing objects",
        "visuals/tables.md": "table.new(), table.cell() for data display",
        "visuals/texts_and_shapes.md": "label.new(), plotshape(), plotchar()",
        # Writing Scripts
        "writing_scripts/style_guide.md": "Naming conventions, code organization, best practices",
        "writing_scripts/debugging.md": "Debugging techniques, log.*, runtime.error()",
        "writing_scripts/limitations.md": "Pine Script limitations, max bars, memory limits",
        "writing_scripts/profiling_and_optimization.md": "Performance optimization, profiling tools",
        # Migration
        "reference/migration_v5_to_v6.md": "v5 to v6 migration guide, breaking changes, renamed functions",
    }
Behavior4/5

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

Annotations already declare read-only and idempotent behavior. The description adds that it returns files organized by category, which is useful context. No contradictions or missing behavioral aspects.

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 two sentences, concise and front-loaded. Every sentence adds value: first states the purpose, second provides usage guidance. No unnecessary words.

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?

The tool is simple with no output schema, but the description adequately describes the output (files with descriptions organized by category). The sibling tools and usage guidelines provide full context for the user.

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?

Input schema has no parameters, so schema coverage is 100%. The description does not need to add parameter details. A baseline of 4 is appropriate for a parameterless tool.

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 it lists all available Pine Script v6 documentation files with descriptions, organized by category. This is a specific verb+resource, and it distinguishes from siblings like get_doc (single file) and list_sections (sections within a file).

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 description provides explicit guidance on when to use this tool (to list all files) and when to use alternatives: for small files use get_doc, for large files use list_sections then get_section. It even names the specific large files.

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/paulieb89/pinescript-mcp'

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