Skip to main content
Glama
phuihock

TA-Lib MCP Server

by phuihock

calculate_t3

Compute the T3 moving average indicator for financial market analysis using price data to identify trends and generate trading signals.

Instructions

Calculate T3 Moving Average.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwargsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'calculate_t3'. Decorated with @mcp.tool() for registration. Delegates computation to T3Indicator from registry.
    @mcp.tool()
    async def calculate_t3(close: List[float], timeperiod: int = 5, vfactor: float = 0.7) -> Dict[str, Any]:
        try:
            indicator = registry.get_indicator("t3")
            if not indicator:
                raise ValueError("T3 indicator not found")
            market_data = MarketData(close=close)
            result = await indicator.calculate(market_data, {"timeperiod": timeperiod, "vfactor": vfactor})
            if result.success:
                return {"success": True, "values": result.values, "metadata": result.metadata}
            return {"success": False, "error": result.error_message}
        except Exception as e:
            return {"success": False, "error": str(e)}
  • Core computation logic in T3Indicator.calculate(), using TA-Lib's ta.T3() function.
    async def calculate(self, market_data: MarketData, options: Dict[str, Any] = None) -> IndicatorResult:
        if options is None:
            options = {}
        timeperiod = options.get("timeperiod", 5)
        vfactor = options.get("vfactor", 0.7)
        close = np.asarray(market_data.close, dtype=float)
    
        try:
            out = ta.T3(close, timeperiod=timeperiod, vfactor=vfactor)
            return IndicatorResult(indicator_name=self.name, success=True, values={"t3": out.tolist()}, metadata={"timeperiod": timeperiod, "vfactor": vfactor, "input_points": len(close), "output_points": len(out)})
        except Exception as e:
            return IndicatorResult(indicator_name=self.name, success=False, values={}, error_message=str(e))
  • JSON schema for input parameters to the T3 indicator (note: tool uses 'close' param).
    @property
    def input_schema(self) -> Dict[str, Any]:
        return {"type": "object", "properties": {"close_prices": {"type": "array", "items": {"type": "number"}}, "timeperiod": {"type": "integer", "default": 5}, "vfactor": {"type": "number", "default": 0.7}}, "required": ["close_prices"]}
  • Registers T3Indicator in the global indicator registry under 't3' key, enabling lookup in tool handler.
    registry.register("t3", T3Indicator)
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the calculation action without detailing inputs, outputs, error conditions, performance characteristics, or any side effects. For a tool with one required parameter and an output schema, this lack of information is inadequate, failing to inform the agent about how the tool behaves or what to expect from its execution.

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 with a single sentence, 'Calculate T3 Moving Average.', which is front-loaded and wastes no words. While this brevity contributes to clarity in structure, it comes at the cost of completeness, as noted in other dimensions. Every word serves a purpose, even if the overall content is insufficient.

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

Completeness2/5

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

Given the complexity of financial calculations and the presence of an output schema, the description is incomplete. It lacks essential details such as parameter explanations, usage context, and behavioral traits, despite the output schema potentially covering return values. With no annotations and low schema coverage, the description fails to provide enough information for effective tool use, especially in a server with many similar tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, and the description does not compensate by explaining the 'kwargs' parameter. It provides no information on what 'kwargs' should contain, its format, or examples of valid inputs. With one required parameter that is entirely undocumented, the agent cannot infer how to invoke the tool correctly, making this a critical gap in parameter semantics.

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

Purpose2/5

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

The description 'Calculate T3 Moving Average' restates the tool name 'calculate_t3' with minimal elaboration, making it tautological. While it identifies the operation (calculate) and the specific technical indicator (T3 Moving Average), it lacks differentiation from sibling tools like 'calculate_sma' or 'calculate_ema', which perform similar calculations for other moving averages. This provides a basic purpose but fails to specify what makes T3 unique or its typical use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives. With multiple sibling tools for calculating different types of moving averages (e.g., SMA, EMA, DEMA, TEMA), there is no indication of T3's specific applications, advantages, or scenarios where it might be preferred over others. This absence of context leaves the agent without direction for tool selection among similar options.

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/phuihock/mcp-talib'

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