list_resources
Discover available Taiwan stock market data resources, including templates and examples, to access real-time prices, historical data, and company information.
Instructions
List all available MCP resources with templates and examples
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp_server.py:243-273 (handler)The main handler function for the 'list_resources' tool. It uses resource_manager to fetch resource templates, cache statistics, and active subscriptions, returning them in a structured dictionary with metadata. Handles exceptions gracefully.@mcp.tool(name="list_resources", description="List all available MCP resources with templates and examples") async def list_resources_tool() -> Dict[str, Any]: """List all available MCP resources.""" try: templates = resource_manager.list_resource_templates() cache_stats = resource_manager.get_cache_stats() subscriptions = resource_manager.get_subscriptions() return { "resource_templates": templates, "cache_statistics": cache_stats, "active_subscriptions": subscriptions, "total_resources": len(templates), "_metadata": { "source": "tw-stock-agent", "timestamp": datetime.now().isoformat(), "data_type": "resource_discovery" } } except Exception as e: logger.error(f"Failed to list resources: {e}") return { "error": f"Failed to list resources: {str(e)}", "_metadata": { "source": "tw-stock-agent", "timestamp": datetime.now().isoformat(), "data_type": "resource_discovery", "has_error": True } }
- mcp_server.py:243-244 (registration)The @mcp.tool decorator registers the list_resources_tool function as an MCP tool named 'list_resources' with a description.@mcp.tool(name="list_resources", description="List all available MCP resources with templates and examples")