Skip to main content
Glama

generate_frontend

Generate Next.js frontend code for Arbitrum dApps using wagmi v2 and RainbowKit. Create contract-integrated interfaces with specified templates and UI frameworks.

Instructions

Generate Next.js frontend code for Arbitrum dApps. Uses wagmi v2 and RainbowKit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYesDescription of the frontend functionality needed
templateNoSpecific template to use (auto-selected if not provided)
contract_abiNoContract ABI JSON string for generating hooks
contract_addressNoContract address to integrate with
ui_frameworkNoUI framework to usedaisyui

Implementation Reference

  • The 'execute' method within 'GenerateFrontendTool' handles the generation of frontend code based on the provided prompt and optional parameters by selecting a template, customizing it with contract details, and generating supporting files like package.json and tests.
    def execute(self, **kwargs) -> dict[str, Any]:
        """Generate frontend code based on the request."""
        prompt = kwargs.get("prompt", "")
        template_name = kwargs.get("template")
        contract_abi = kwargs.get("contract_abi")
        contract_address = kwargs.get("contract_address", "0x...")
        ui_framework = kwargs.get("ui_framework", "daisyui")
        include_tests = kwargs.get("include_tests", False)
    
        # Validate inputs
        if not prompt:
            return {"error": "prompt is required"}
    
        # Select template
        if template_name:
            template = get_frontend_template(template_name)
            if not template:
                return {"error": f"Unknown template: {template_name}"}
        else:
            template = select_frontend_template(prompt)
    
        # Context retrieval (template-based generation doesn't require RAG)
        context = []
    
        # Customize template based on prompt
        files = self._customize_template(template, prompt, contract_abi, contract_address)
    
        # Generate package.json
        package_json = self._generate_package_json(template, prompt)
    
        # Add test files if requested
        if include_tests:
            test_files = self._generate_tests(template, prompt)
            files.update(test_files)
    
        # Build response
        result = {
            "template_used": template.name,
            "framework": template.framework,
            "files": files,
            "package_json": package_json,
            "dependencies": template.dependencies,
            "dev_dependencies": template.dev_dependencies,
            "env_vars": template.env_vars,
            "scripts": template.scripts,
            "setup_instructions": self._get_setup_instructions(template),
        }
    
        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 required 'prompt' and optional parameters like 'template', 'contract_abi', 'contract_address', 'ui_framework', and 'include_tests' for the generate_frontend tool.
    input_schema = {
        "type": "object",
        "properties": {
            "prompt": {
                "type": "string",
                "description": "Description of the frontend functionality needed",
            },
            "template": {
                "type": "string",
                "enum": ["nextjs_wagmi", "daisyui_components", "contract_dashboard", "token_interface"],
                "description": "Specific template to use (optional, auto-selected if not provided)",
            },
            "contract_abi": {
                "type": "string",
                "description": "Contract ABI JSON string for generating hooks",
            },
            "contract_address": {
                "type": "string",
                "description": "Contract address to integrate with",
            },
            "ui_framework": {
                "type": "string",
                "enum": ["tailwind", "daisyui"],
                "description": "UI framework to use",
                "default": "daisyui",
            },
            "include_tests": {
                "type": "boolean",
                "description": "Include test files",
                "default": False,
            },
        },
        "required": ["prompt"],
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral information. It mentions the technologies used (wagmi v2, RainbowKit) but doesn't describe what the tool actually produces (files, structure), whether it modifies existing code, error handling, or any limitations. The description is functional but lacks operational transparency.

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 extremely concise with just two sentences that directly state the tool's purpose and technologies. Every word earns its place with zero redundancy or unnecessary elaboration, making it efficiently front-loaded with essential information.

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 code generation tool with 5 parameters and no annotations or output schema, the description is insufficient. It doesn't explain what kind of output to expect (files, code snippets, project structure), how generated code integrates, or any constraints. The description provides basic purpose but lacks operational context needed for effective use.

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 5 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema, maintaining the baseline score of 3. It doesn't explain relationships between parameters or provide usage examples.

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 generates Next.js frontend code for Arbitrum dApps using wagmi v2 and RainbowKit, providing specific technologies and target platform. It distinguishes from siblings like generate_backend or generate_tests by focusing on frontend, but doesn't explicitly contrast with other frontend-related tools like generate_bridge_code or generate_messaging_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?

No guidance is provided about when to use this tool versus alternatives. While it's clear this is for frontend generation, there's no mention of when to choose it over other code generation tools like generate_bridge_code or generate_messaging_code, nor any prerequisites or constraints for usage.

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