Skip to main content
Glama

list_queries

Discover available blockchain data queries from contract ABIs to access specific information for analysis and decision-making.

Instructions

List all available NIX query actions from the contract ABI

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contractNoContract to list queries fromnix.q
filter_patternNoOptional filter pattern for query names
environmentNoEnvironment (dev, uat, cdev, perf, simnext, prod, local)dev

Implementation Reference

  • Primary MCP tool handler for 'list_queries'. Decorated with @mcp.tool(), defines input schema via Pydantic Field, creates SimpleNixClient, calls helper function, and returns result as string.
    @mcp.tool() async def list_queries( contract: str = Field(default="nix.q", description="Contract to list queries from"), filter_pattern: Optional[str] = Field(default=None, description="Optional filter pattern for query names"), environment: str = Field(default="dev", description="Environment (dev, uat, cdev, perf, simnext, prod, local)") ) -> str: """List all available NIX query actions from the contract ABI""" # Create client with specified environment client = SimpleNixClient(environment=environment) result = await handle_list_queries(client, contract, filter_pattern, environment) return result[0].text
  • Core helper function implementing the query listing logic: fetches actions using ABIFetcher, filters by pattern, formats as JSON TextContent, handles errors.
    async def handle_list_queries( client: SimpleNixClient, contract: str = "nix.q", filter_pattern: Optional[str] = None, environment: str = "dev" ) -> List[TextContent]: """ List all available NIX query actions Args: client: SimpleNixClient instance contract: Contract to list queries from (default: nix.q) filter_pattern: Optional filter pattern for query names environment: Environment name Returns: List containing TextContent with available queries """ try: fetcher = ABIFetcher(nodeos_api=client.nodeos_api, environment=environment) actions = fetcher.get_actions(contract) # Apply filter if provided if filter_pattern: filter_lower = filter_pattern.lower() actions = [a for a in actions if filter_lower in a.lower()] result = { "contract": contract, "environment": environment, "total_queries": len(actions), "queries": actions } return [TextContent( type="text", text=json.dumps(result, indent=2) )] except Exception as e: logger.error(f"Error listing queries: {e}") return [TextContent( type="text", text=f"Error: {str(e)}" )]
  • Input schema definition using Pydantic Field for the list_queries tool parameters.
    async def list_queries( contract: str = Field(default="nix.q", description="Contract to list queries from"), filter_pattern: Optional[str] = Field(default=None, description="Optional filter pattern for query names"), environment: str = Field(default="dev", description="Environment (dev, uat, cdev, perf, simnext, prod, local)") ) -> str:
  • Import of the handle_list_queries helper function used by the tool.
    from .tools import ( handle_list_queries, handle_get_query_abi, handle_query )

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/haiqiubullish/nix-mcp'

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