Skip to main content
Glama

coingeckotokeninfoagent_get_tokens_by_category

Retrieve detailed cryptocurrency token data by category using the CoinGecko API. Access prices, market caps, trading volumes, and price changes sorted by user-defined parameters such as market cap or volume.

Instructions

Get a list of tokens within a specific category. This tool retrieves token data for all cryptocurrencies that belong to a particular category, including price, market cap, volume, and price changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
category_idYesThe CoinGecko category ID (e.g., 'layer-1')
orderNoSort order for tokens (default: market_cap_desc)market_cap_desc
pageNoPage number (default: 1)
per_pageNoNumber of results per page (1-250, default: 100)
vs_currencyNoThe currency to show results in (default: usd)usd

Implementation Reference

  • Generic MCP tool handler that parses the prefixed tool name (e.g., 'coingeckotokeninfoagent_get_tokens_by_category'), extracts agent_id and tool_name, proxies the execution to the remote Mesh API via execute_tool, and returns the result as TextContent.
    @app.call_tool() async def call_tool(name: str, arguments: dict) -> List[types.TextContent]: """Call the specified tool with the given arguments.""" try: if name not in self.tool_registry: raise ValueError(f"Unknown tool: {name}") tool_info = self.tool_registry[name] result = await self.execute_tool( agent_id=tool_info["agent_id"], tool_name=tool_info["tool_name"], tool_arguments=arguments, ) # Convert result to TextContent return [types.TextContent(type="text", text=str(result))] except Exception as e: logger.error(f"Error calling tool {name}: {e}") raise ValueError(f"Failed to call tool {name}: {str(e)}") from e
  • Dynamic tool registration logic: constructs the exact tool name format '{agent_id.lower()}_{tool_name}' (matching 'coingeckotokeninfoagent_get_tokens_by_category') from remote metadata and stores schema, description in tool_registry used by MCP server.
    if not tool_name: continue # Create a unique tool ID tool_id = f"{agent_id.lower()}_{tool_name}" # Get parameters or create default schema parameters = function_data.get("parameters", {}) if not parameters: parameters = { "type": "object", "properties": {}, "required": [], } # Store tool info tool_registry[tool_id] = { "agent_id": agent_id, "tool_name": tool_name, "description": function_data.get("description", ""), "parameters": parameters, }
  • MCP list_tools implementation that exposes the dynamically registered tools including their inputSchema from remote metadata.
    @app.list_tools() async def list_tools() -> List[types.Tool]: """List all available tools.""" return [ types.Tool( name=tool_id, description=tool_info["description"], inputSchema=tool_info["parameters"], ) for tool_id, tool_info in self.tool_registry.items() ]
  • Hardcoded list of supported agents that includes 'CoinGeckoTokenInfoAgent', enabling tools from this agent (prefix 'coingeckotokeninfoagent_') such as the target tool.
    DEFAULT_AGENTS = [ "CoinGeckoTokenInfoAgent", "DexScreenerTokenInfoAgent", "ElfaTwitterIntelligenceAgent", "ExaSearchAgent", "TwitterInfoAgent", "AIXBTProjectInfoAgent", "EtherscanAgent", "EvmTokenInfoAgent", "FundingRateAgent", "UnifaiTokenAnalysisAgent", "YahooFinanceAgent", "ZerionWalletAnalysisAgent" ]
  • Helper function that performs the actual remote API call to execute the tool on the specified agent, used by the handler.
    async def execute_tool( self, agent_id: str, tool_name: str, tool_arguments: Dict[str, Any] ) -> Dict[str, Any]: """Execute a tool on a mesh agent. Args: agent_id: ID of the agent to execute the tool on tool_name: Name of the tool to execute tool_arguments: Arguments to pass to the tool Returns: Tool execution result Raises: ToolExecutionError: If there's an error executing the tool """ request_data = { "agent_id": agent_id, "input": {"tool": tool_name, "tool_arguments": tool_arguments}, } # Add API key if available if Config.HEURIST_API_KEY: request_data["api_key"] = Config.HEURIST_API_KEY try: result = await call_mesh_api( "mesh_request", method="POST", json=request_data ) return result.get("data", result) # Prefer the 'data' field if it exists except MeshApiError as e: # Re-raise API errors with clearer context raise ToolExecutionError(str(e)) from e except Exception as e: logger.error(f"Error calling {agent_id} tool {tool_name}: {e}") raise ToolExecutionError( f"Failed to call {agent_id} tool {tool_name}: {str(e)}" ) from e

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/heurist-network/heurist-mesh-mcp-server'

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