Skip to main content
Glama

generate_indexer

Create subgraph code to index Arbitrum smart contracts for The Graph, enabling blockchain data querying and analysis.

Instructions

Generate subgraph code for indexing Arbitrum contracts with The Graph.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the indexing requirements
templateNoType of subgraph template to use
contract_addressNoContract address to index
contract_abiNoContract ABI JSON string for custom events
start_blockNoBlock number to start indexing from
networkNoNetwork to deploy the subgrapharbitrum-sepolia

Implementation Reference

  • The execute method in GenerateIndexerTool handles the generation of subgraph indexing code, including template selection and customization.
    def execute(self, **kwargs) -> dict[str, Any]:
        """Generate subgraph code based on the request."""
        prompt = kwargs.get("prompt", "")
        template_name = kwargs.get("template")
        contract_address = kwargs.get("contract_address", "0x0000000000000000000000000000000000000000")
        contract_abi = kwargs.get("contract_abi")
        start_block = kwargs.get("start_block", 0)
        network = kwargs.get("network", "arbitrum-sepolia")
        events = kwargs.get("events", [])
    
        # Validate inputs
        if not prompt:
            return {"error": "prompt is required"}
    
        # Select template
        if template_name:
            template = get_indexer_template(template_name)
            if not template:
                return {"error": f"Unknown template: {template_name}"}
        else:
            template = select_indexer_template(prompt)
    
        # Context retrieval (template-based generation doesn't require RAG)
        context = []
    
        # Customize template
        files = self._customize_template(
            template,
            prompt,
            contract_address,
            contract_abi,
            start_block,
            network,
            events,
        )
    
        # Build response
        result = {
            "template_used": template.name,
            "template_type": template.template_type,
            "files": files,
            "dependencies": template.dependencies,
            "networks": template.networks,
            "setup_instructions": self._get_setup_instructions(template, network),
            "deployment_commands": self._get_deployment_commands(network),
        }
    
        if context:
            result["references"] = [
                {
                    "source": c.get("metadata", {}).get("source", "Unknown"),
                    "relevance": c.get("distance", 0),
                }
                for c in context[:3]
            ]
    
        return result
  • The input_schema defines the expected parameters for the generate_indexer tool, such as prompt, template type, contract details, and networking configuration.
    input_schema = {
        "type": "object",
        "properties": {
            "prompt": {
                "type": "string",
                "description": "Description of the indexing requirements",
            },
            "template": {
                "type": "string",
                "enum": ["erc20", "erc721", "defi", "custom"],
                "description": "Type of subgraph template to use",
            },
            "contract_address": {
                "type": "string",
                "description": "Contract address to index",
            },
            "contract_abi": {
                "type": "string",
                "description": "Contract ABI JSON string for custom events",
            },
            "start_block": {
                "type": "integer",
                "description": "Block number to start indexing from",
                "default": 0,
            },
            "network": {
                "type": "string",
                "enum": ["arbitrum-one", "arbitrum-sepolia"],
                "description": "Network to deploy the subgraph",
                "default": "arbitrum-sepolia",
            },
            "events": {
                "type": "array",
                "items": {"type": "string"},
                "description": "List of event names to index (for custom template)",
            },
        },
        "required": ["prompt"],
    }
  • The generate_indexer tool is registered in the MCP server's tools dictionary.
    "generate_indexer": GenerateIndexerTool(),
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't mention any behavioral traits such as whether it's a read-only operation, if it has side effects (e.g., creating files or deploying code), rate limits, authentication needs, or error handling. This is a significant gap for a tool with multiple parameters and no structured safety hints.

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, clear sentence with zero waste—it directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to understand at a glance.

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

Completeness2/5

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

Given the complexity (6 parameters, no annotations, no output schema), the description is incomplete. It lacks behavioral context, usage guidelines, and any mention of output or side effects. For a tool that likely generates code with potential deployment implications, this leaves significant gaps for an AI agent to infer correct usage.

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?

Schema description coverage is 100%, so the input schema already documents all parameters thoroughly. The description adds no additional meaning beyond what's in the schema (e.g., it doesn't explain how parameters interact or provide examples). This meets the baseline of 3 when the schema does the heavy lifting.

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 ('generate subgraph code') and the target ('for indexing Arbitrum contracts with The Graph'), which is specific and actionable. However, it doesn't explicitly differentiate from sibling tools like generate_backend or generate_frontend, which might also involve code generation for different components.

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. With many sibling tools focused on code generation (e.g., generate_backend, generate_frontend, generate_bridge_code), there's no indication of the specific context or prerequisites for choosing this tool over others.

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/Quantum3-Labs/ARBuilder'

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