Skip to main content
Glama
clsung

Taiwan Stock Agent

by clsung

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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")

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/clsung/tw-stock-agent'

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