Skip to main content
Glama

generate_validator_setup

Generate code to manage Orbit chain validators, batch posters, and AnyTrust DAC keysets for Arbitrum deployments.

Instructions

Generate code for managing Orbit chain validators, batch posters, and AnyTrust DAC keysets.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the validator management action
actionNoAction to performlist
targetNoTarget entity to managevalidator
addressesNoAddresses to check, add, or remove
rollup_addressNoRollup contract address on parent chain
sequencer_inboxNoSequencerInbox contract address
parent_chainNoParent chain where contracts are deployedarbitrum-sepolia

Implementation Reference

  • The execute method of GenerateValidatorSetupTool generates TypeScript code for managing validators and batch posters based on the requested action (list, add, remove) and target (validator, batch_poster, keyset).
    def execute(self, **kwargs) -> dict[str, Any]:
        """Generate validator/batch poster management code."""
        prompt = kwargs.get("prompt", "")
        action = kwargs.get("action", "list")
        target = kwargs.get("target", "validator")
        addresses = kwargs.get("addresses", [])
        rollup_address = kwargs.get(
            "rollup_address", "0x0000000000000000000000000000000000000000"
        )
        sequencer_inbox = kwargs.get(
            "sequencer_inbox", "0x0000000000000000000000000000000000000000"
        )
        parent_chain = kwargs.get("parent_chain", "arbitrum-sepolia")
    
        if not prompt:
            return {"error": "prompt is required"}
    
        # Get parent chain info
        parent_rpc = PARENT_CHAIN_RPCS.get(
            parent_chain, PARENT_CHAIN_RPCS["arbitrum-sepolia"]
        )
        parent_chain_id = self._get_parent_chain_id(parent_chain)
        parent_chain_name = parent_chain.replace("-", " ").title()
    
        # Select appropriate template based on target and action
        template_name: str
        if target == "keyset":
            template = get_orbit_template("anytrust_config")
            template_name = template.name if template else "Orbit AnyTrust Config"
        elif action in ("add", "remove"):
            template = None  # Use inline mutate template
            template_name = (
                "Orbit Add Validators"
                if action == "add"
                else "Orbit Remove Validators"
            )
        else:
            template = get_orbit_template("validator_management")
            template_name = template.name if template else "Orbit Validator Management"
    
        if target == "keyset" and not template:
            return {"error": "Template not found for keyset target"}
        if action == "list" and target != "keyset" and not template:
            return {"error": "Template not found for validator list"}
    
        # Format addresses array
        addresses_str = self._format_address_array(addresses)
    
        # Get code from the appropriate source
        if action in ("add", "remove"):
            code = MUTATE_VALIDATOR_TEMPLATE_CODE
        else:
            code = template.code  # type: ignore[union-attr]
    
        # Substitute parameters
        action_verb = "Removing" if action == "remove" else "Adding"
        action_bool = "false" if action == "remove" else "true"
        code = code.replace("{parent_chain_id}", str(parent_chain_id))
        code = code.replace("{parent_chain_name}", parent_chain_name)
        code = code.replace("{rollup_address}", rollup_address)
        code = code.replace("{sequencer_inbox}", sequencer_inbox)
        code = code.replace("{addresses_array}", addresses_str)
        code = code.replace("{action_verb}", action_verb)
        code = code.replace("{action_bool}", action_bool)
    
        # Build files
        files = {}
        if target == "keyset":
            files["scripts/manage-keyset.ts"] = validate_template_output(
                code, "manage-keyset"
            )
        else:
            files["scripts/manage-validators.ts"] = validate_template_output(
                code, "manage-validators"
            )
    
        # Add .env.example
        files[".env.example"] = (
            f"DEPLOYER_PRIVATE_KEY=0x...\n"
            f"PARENT_CHAIN_RPC={parent_rpc}\n"
        )
    
        result = {
            "template_used": template_name,
            "action": action,
            "target": target,
            "files": files,
            "dependencies": ORBIT_DEPENDENCIES,
            "parent_chain": {
                "name": parent_chain,
                "chain_id": parent_chain_id,
                "rpc": parent_rpc,
            },
            "contract_addresses": {
                "rollup": rollup_address,
                "sequencer_inbox": sequencer_inbox,
            },
            "addresses_to_manage": addresses,
            "setup_instructions": [
                "1. Install dependencies: npm install viem dotenv",
                "2. Copy .env.example to .env and configure",
                f"3. Run: npx tsx {list(files.keys())[0]}",
            ],
            "notes": self._get_notes(action, target),
            "disclaimer": TEMPLATE_DISCLAIMER,
        }
    
        return result
  • Input schema for the generate_validator_setup tool.
    input_schema = {
        "type": "object",
        "properties": {
            "prompt": {
                "type": "string",
                "description": "Description of the validator management action",
            },
            "action": {
                "type": "string",
                "enum": ["list", "add", "remove"],
                "description": "Action to perform",
                "default": "list",
            },
            "target": {
                "type": "string",
                "enum": ["validator", "batch_poster", "keyset"],
                "description": "Target entity to manage",
                "default": "validator",
            },
            "addresses": {
                "type": "array",
                "items": {"type": "string"},
                "description": "Addresses to check, add, or remove",
            },
            "rollup_address": {
                "type": "string",
                "description": "Rollup contract address on parent chain",
            },
            "sequencer_inbox": {
                "type": "string",
                "description": "SequencerInbox contract address on parent chain",
            },
            "parent_chain": {
                "type": "string",
                "enum": [
                    "arbitrum-one",
                    "arbitrum-sepolia",
                    "ethereum-mainnet",
                    "ethereum-sepolia",
                ],
                "description": "Parent chain where contracts are deployed",
                "default": "arbitrum-sepolia",
            },
        },
        "required": ["prompt"],
    }
  • Tool registration for generate_validator_setup in the MCP server.
    "generate_validator_setup": GenerateValidatorSetupTool(),
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 states the tool 'generates code' but doesn't clarify what type of code (e.g., scripts, configuration files, smart contracts), where the code is output, whether it's executable or requires additional steps, or what permissions/authentication might be needed. The description is too vague about the tool's actual behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence that gets straight to the point without unnecessary words. It's appropriately sized for the tool's complexity, though it could potentially be more specific about the type of code generated.

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?

For a tool with 7 parameters (including complex enums and arrays), no annotations, and no output schema, the description is insufficient. It doesn't explain what the generated code looks like, how it should be used, what dependencies it might have, or provide any examples. The description leaves too many open questions about the tool's actual functionality and output.

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 schema already documents all 7 parameters thoroughly. The description mentions 'managing Orbit chain validators, batch posters, and AnyTrust DAC keysets' which aligns with the 'target' parameter enum values, but adds no additional semantic context beyond what's already in the well-documented schema.

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 tool's purpose as 'Generate code for managing Orbit chain validators, batch posters, and AnyTrust DAC keysets.' It specifies the verb ('generate code') and resources (validators, batch posters, keysets), but doesn't explicitly differentiate from sibling tools like 'generate_orbit_config' or 'generate_orbit_deployment' that might also generate Orbit-related code.

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 like 'generate_orbit_config', 'generate_orbit_deployment', and 'generate_bridge_code', there's no indication of what distinguishes this code generation tool from those others or when it should be selected.

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