Skip to main content
Glama
twelvedata

Twelve Data MCP Server

Official
by twelvedata

GetPrice

Retrieve real-time price data for financial instruments using symbol, FIGI, ISIN, or other identifiers. Integrates with Twelve Data API to deliver precise market pricing for stocks, forex, and cryptocurrencies.

Instructions

This endpoint is a lightweight method that allows retrieving only the real-time price of the selected instrument.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • Core handler logic executed by all Twelve Data API tools, including GetPrice. Adds API key, resolves path parameters, makes HTTP GET request to api_base/endpoint with params, handles errors, and validates response with Pydantic model.
    async def _call_endpoint( endpoint: str, params: P, response_model: Type[R], ctx: Context ) -> R: params.apikey = extract_twelve_data_apikey( twelve_data_apikey=twelve_data_apikey, transport=transport, ctx=ctx ) params_dict = params.model_dump(exclude_none=True) resolved_endpoint = resolve_path_params(endpoint, params_dict) async with httpx.AsyncClient( trust_env=False, headers={ "accept": "application/json", "user-agent": "python-httpx/0.24.0" }, ) as client: resp = await client.get( f"{api_base}/{resolved_endpoint}", params=params_dict ) resp.raise_for_status() resp_json = resp.json() if isinstance(resp_json, dict): status = resp_json.get("status") if status == "error": code = resp_json.get('code') raise HTTPException( status_code=code, detail=f"Failed to perform request," f" code = {code}, message = {resp_json.get('message')}" ) return response_model.model_validate(resp_json)
  • Calls register_all_tools which registers GetPrice among all other tools when vector DB exists.
    if vector_db_exists(): register_all_tools(server=server, _call_endpoint=_call_endpoint)
  • Calls register_all_tools which registers GetPrice among all other tools in basic mode (no U-tool or doc-tool).
    register_all_tools(server=server, _call_endpoint=_call_endpoint)

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/twelvedata/mcp'

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