Skip to main content
Glama
JCF0

CG Alpha MCP

by JCF0

ta_bollinger

Read-only

Calculate Bollinger Bands for market analysis to identify volatility and potential price breakouts using moving averages and standard deviation.

Instructions

Compute Bollinger Bands (SMA + population stdev). Inputs: values:number[] (oldest→newest), period?:number(20), mult?:number(2).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
valuesYes
periodNo
multNo

Implementation Reference

  • The MCP tool handler for 'ta_bollinger'. Validates input parameters (values array, optional period and mult), calls the bollinger helper function, and formats the response.
    "ta_bollinger": async (args) => {
      const values = Array.isArray(args?.values) ? args.values : null;
      const period = Number.isFinite(Number(args?.period)) ? Number(args.period) : 20;
      const mult   = Number.isFinite(Number(args?.mult))   ? Number(args.mult)   : 2;
      if (!values || values.length === 0) {
        return { content: textContent({ error:true, message:"'values' must be a non-empty array of numbers (oldest → newest)" }), isError:true };
      }
      const out = taBoll(values, period, mult);
      return { content: textContent({ ok:true, ...out, period, mult }) };
    },
  • mcp-server.js:336-344 (registration)
    Tool registration entry in the tools list, including description, input schema, and annotations. Used by the MCP server's tools/list method.
    { name:"ta_bollinger",
      description:"Compute Bollinger Bands (SMA + population stdev). Inputs: values:number[] (oldest→newest), period?:number(20), mult?:number(2).",
      inputSchema:{ type:"object", properties:{
        values:{ type:"array", items:{ type:"number" } },
        period:{ type:"number" },
        mult:{ type:"number" }
      }, required:["values"] },
      annotations:{ title:"TA: Bollinger Bands", readOnlyHint:true, openWorldHint:false }
    },
  • Input schema definition for the ta_bollinger tool, specifying the expected arguments.
    inputSchema:{ type:"object", properties:{
      values:{ type:"array", items:{ type:"number" } },
      period:{ type:"number" },
      mult:{ type:"number" }
    }, required:["values"] },
  • Core implementation of Bollinger Bands computation: calculates SMA mean, population stdev, upper/lower bands, and derived metrics (percentB, bandwidth) over the last 'period' values.
    export function bollinger(values, period = 20, mult = 2) {
      const arr = normalize(values);
      if (arr.length < period) return null;
    
      const slice = arr.slice(-period);
      const mean = avg(slice);
      if (!isFiniteNum(mean)) return null;
    
      const variance = avg(slice.map(v => (v - mean) * (v - mean)));
      const stdev = Math.sqrt(variance);
      if (!isFiniteNum(stdev)) return null;
    
      const upper = mean + mult * stdev;
      const lower = mean - mult * stdev;
      const last  = arr[arr.length - 1];
    
      // Avoid division by zero in derived metrics
      const denomBands = upper - lower;
      const denomMean  = mean;
    
      const percentB =
        isFiniteNum(denomBands) && denomBands !== 0
          ? (last - lower) / denomBands
          : null;
    
      const bandwidth =
        isFiniteNum(denomMean) && denomMean !== 0
          ? (upper - lower) / denomMean
          : null;
    
      return {
        mean,
        upper,
        lower,
        last,
        percentB: isFiniteNum(percentB) ? percentB : null,
        bandwidth: isFiniteNum(bandwidth) ? bandwidth : null
      };
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, indicating a safe, deterministic calculation. The description adds context about the calculation method ('SMA + population stdev') and data orientation ('oldest→newest'), which helps understand the tool's behavior beyond the annotations. However, it doesn't disclose performance characteristics, error conditions, or output format details.

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 extremely concise and well-structured in a single sentence. It front-loads the purpose, then efficiently documents all parameters with their types, defaults, and important semantics (data ordering). Every element serves a clear purpose with zero wasted words.

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

Completeness3/5

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

For a calculation tool with good annotations (readOnlyHint, openWorldHint) but no output schema, the description adequately covers the core functionality and parameters. However, it doesn't explain what the tool returns (Bollinger Band values, SMA line, etc.) or how results are structured, leaving gaps for an agent to understand the output format.

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?

With 0% schema description coverage, the description fully compensates by explaining all three parameters: 'values:number[] (oldest→newest)' clarifies data structure and ordering, 'period?:number(20)' provides default value and optionality, and 'mult?:number(2)' provides default value and optionality. This adds essential meaning beyond the bare schema, though it doesn't explain parameter constraints or validation rules.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Compute Bollinger Bands (SMA + population stdev).' It specifies the verb ('Compute') and resource ('Bollinger Bands') with technical detail about the calculation method. However, it doesn't explicitly differentiate from sibling technical analysis tools like 'ta_rsi' or 'ta_summary' beyond mentioning the specific indicator name.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'ta_rsi' or 'ta_summary' for different technical indicators, nor does it specify appropriate contexts or prerequisites for Bollinger Bands analysis. The parameter documentation implies usage but offers no comparative guidance.

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/JCF0/cg-alpha-mcp'

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