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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

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
    )
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It only states what the tool does ('List all available...') without mentioning any behavioral traits like whether it's read-only, has side effects, requires authentication, has rate limits, or describes the return format. This is inadequate for a tool with parameters and potential complexity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that there's an output schema (which handles return values) and 100% schema coverage for parameters, the description's minimal approach is somewhat acceptable. However, for a tool with no annotations and sibling tools, it lacks context about behavioral traits and usage differentiation, making it incomplete for optimal agent guidance.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already fully documents all three parameters. The description adds no additional meaning about parameters beyond what's in the schema, such as explaining how the filter pattern works or when to override defaults. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all available') and resource ('NIX query actions from the contract ABI'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_query_abi' or 'query', which would be needed for a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_query_abi' or 'query'. It doesn't mention prerequisites, exclusions, or comparative contexts, leaving the agent with no usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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