Skip to main content
Glama

configure_clarinet_project

Set up Clarinet project for specific blockchain networks, add dependencies, and configure development environment settings for Stacks smart contract development.

Instructions

Configure Clarinet project settings for different networks, add dependencies, and set up development environment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesNetwork configuration to set up
requirementsNoAdditional requirements or dependencies

Implementation Reference

  • The main handler implementation for the 'configure_clarinet_project' tool. It generates comprehensive configuration instructions, network settings, deployment plans, and development environment setup for Clarinet projects based on the provided network and requirements.
    export const configureClarinetsProjectTool: Tool<undefined, typeof ProjectConfigScheme> = {
      name: "configure_clarinet_project",
      description: "Configure Clarinet project settings for different networks, add dependencies, and set up development environment.",
      parameters: ProjectConfigScheme,
      execute: async (args, context) => {
        try {
          await recordTelemetry({ action: "configure_clarinet_project" }, context);
          
          const network = args.network;
          const requirements = args.requirements || [];
          
          return `# Clarinet Project Configuration
    
    ## Network Configuration: ${network.toUpperCase()}
    
    ### settings/${network.charAt(0).toUpperCase() + network.slice(1)}.toml
    
    \`\`\`toml
    ${getNetworkConfig(network)}
    \`\`\`
    
    ## Updated Clarinet.toml
    
    \`\`\`toml
    [project]
    name = "my-stacks-project"
    authors = ["Your Name <your.email@example.com>"]
    description = "A Stacks blockchain project using Clarity smart contracts"
    telemetry = true
    cache_dir = "./.clarinet/cache"
    requirements = [${requirements.map(req => `"${req}"`).join(', ')}]
    
    [repl]
    costs_version = 3
    parser_version = 2
    
    [repl.analysis]
    passes = ["check_checker"]
    
    [repl.analysis.check_checker]
    strict = true
    trusted_sender = false
    trusted_caller = false
    callee_filter = true
    
    # Development settings
    [repl.development]
    mine_empty_blocks = true
    deployment_fee_rate = 10
    
    # Contract definitions will be added here
    # [contracts.my-contract]
    # path = "contracts/my-contract.clar" 
    # clarity_version = 2
    # epoch = "2.4"
    \`\`\`
    
    ${requirements.length > 0 ? generateRequirementsConfig(requirements) : ''}
    
    ## Environment Setup
    
    ### 1. Development Environment
    \`\`\`bash
    # Install development dependencies
    npm init -y
    npm install --save-dev @hirosystems/clarinet-sdk @stacks/transactions
    
    # Set up environment variables
    echo "STACKS_NETWORK=${network}" > .env
    echo "CLARINET_MODE=development" >> .env
    \`\`\`
    
    ### 2. Network-Specific Settings
    
    #### API Endpoints
    \`\`\`bash
    # ${network.toUpperCase()} endpoints
    ${getNetworkEndpoints(network)}
    \`\`\`
    
    ### 3. Deployment Configuration
    
    Create \`deployments/${network}-plan.yaml\`:
    
    \`\`\`yaml
    ---
    id: 0
    name: ${network}-deployment
    network: ${network}
    stacks-node: "${getStacksNodeUrl(network)}"
    bitcoin-node: "${getBitcoinNodeUrl(network)}"
    plan:
      batches:
        - id: 0
          transactions:
            # Your deployment transactions will be added here
            # - contract-publish:
            #     contract-name: my-contract
            #     expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
            #     cost: 50000
            #     path: contracts/my-contract.clar
    \`\`\`
    
    ### 4. Testing Configuration
    
    Update test configuration in \`tests/\`:
    
    \`\`\`typescript
    // Test configuration for ${network}
    export const testConfig = {
      network: "${network}",
      timeout: 30000,
      accounts: {
        deployer: "${getDefaultDeployer(network)}",
        wallet1: "${getDefaultWallet1(network)}",
        wallet2: "${getDefaultWallet2(network)}"
      },
      contracts: {
        // Your contract configurations
      }
    };
    \`\`\`
    
    ### 5. IDE Configuration
    
    #### VS Code Settings (\`.vscode/settings.json\`)
    \`\`\`json
    {
      "clarinet.enable": true,
      "clarinet.network": "${network}",
      "editor.formatOnSave": true,
      "[clarity]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.rulers": [100]
      },
      "files.associations": {
        "*.clar": "clarity",
        "Clarinet.toml": "toml",
        "*.toml": "toml"
      },
      "emmet.includeLanguages": {
        "clarity": "lisp"
      }
    }
    \`\`\`
    
    ### 6. Development Workflow
    
    \`\`\`bash
    # 1. Start development environment
    clarinet console
    
    # 2. Interactive development commands
    > (contract-call? .my-contract some-function)
    > ::get_costs
    > ::get_contracts_by_trait
    > ::get_accounts
    
    # 3. Run tests for specific network
    clarinet test --${network}
    
    # 4. Deploy to network
    clarinet deployments generate --${network}
    clarinet deployments apply --${network}
    
    # 5. Monitor deployment
    clarinet deployments check --${network}
    \`\`\`
    
    ### 7. Security Configuration
    
    #### Network Security Settings
    \`\`\`toml
    # Add to your ${network} settings
    [security]
    enable_signers = true
    require_signatures = ${network === 'mainnet' ? 'true' : 'false'}
    max_contract_size = 1048576  # 1MB
    gas_limit = 15000000
    \`\`\`
    
    ### 8. Performance Optimization
    
    \`\`\`toml
    # Performance settings for ${network}
    [performance]
    parallel_testing = true
    cache_contracts = true
    optimize_builds = true
    cost_analysis = ${network === 'devnet' ? 'detailed' : 'summary'}
    \`\`\`
    
    ## Next Steps
    
    1. **Add Contracts**: Use \`generate_clarity_contract\` to add smart contracts
    2. **Write Tests**: Use \`generate_contract_tests\` for comprehensive testing
    3. **Configure CI/CD**: Set up automated testing and deployment
    4. **Monitor Performance**: Use cost analysis tools
    5. **Deploy**: Follow the deployment workflow for ${network}
    
    Your Clarinet project is now configured for ${network} development!`;
          
        } catch (error) {
          return `❌ Failed to configure project: ${error}`;
        }
      },
    };
  • Zod schema defining the input parameters for the configure_clarinet_project tool: network (devnet/testnet/mainnet) and optional requirements array.
    const ProjectConfigScheme = z.object({
      network: z.enum(["devnet", "testnet", "mainnet"]).describe("Network configuration to set up"),
      requirements: z.array(z.string()).optional().describe("Additional requirements or dependencies"),
    });
  • The tool is defined and exported as configureClarinetsProjectTool, which serves as its registration in the MCP tools system.
    export const configureClarinetsProjectTool: Tool<undefined, typeof ProjectConfigScheme> = {
      name: "configure_clarinet_project",
      description: "Configure Clarinet project settings for different networks, add dependencies, and set up development environment.",
      parameters: ProjectConfigScheme,
      execute: async (args, context) => {
        try {
          await recordTelemetry({ action: "configure_clarinet_project" }, context);
          
          const network = args.network;
          const requirements = args.requirements || [];
          
          return `# Clarinet Project Configuration
    
    ## Network Configuration: ${network.toUpperCase()}
    
    ### settings/${network.charAt(0).toUpperCase() + network.slice(1)}.toml
    
    \`\`\`toml
    ${getNetworkConfig(network)}
    \`\`\`
    
    ## Updated Clarinet.toml
    
    \`\`\`toml
    [project]
    name = "my-stacks-project"
    authors = ["Your Name <your.email@example.com>"]
    description = "A Stacks blockchain project using Clarity smart contracts"
    telemetry = true
    cache_dir = "./.clarinet/cache"
    requirements = [${requirements.map(req => `"${req}"`).join(', ')}]
    
    [repl]
    costs_version = 3
    parser_version = 2
    
    [repl.analysis]
    passes = ["check_checker"]
    
    [repl.analysis.check_checker]
    strict = true
    trusted_sender = false
    trusted_caller = false
    callee_filter = true
    
    # Development settings
    [repl.development]
    mine_empty_blocks = true
    deployment_fee_rate = 10
    
    # Contract definitions will be added here
    # [contracts.my-contract]
    # path = "contracts/my-contract.clar" 
    # clarity_version = 2
    # epoch = "2.4"
    \`\`\`
    
    ${requirements.length > 0 ? generateRequirementsConfig(requirements) : ''}
    
    ## Environment Setup
    
    ### 1. Development Environment
    \`\`\`bash
    # Install development dependencies
    npm init -y
    npm install --save-dev @hirosystems/clarinet-sdk @stacks/transactions
    
    # Set up environment variables
    echo "STACKS_NETWORK=${network}" > .env
    echo "CLARINET_MODE=development" >> .env
    \`\`\`
    
    ### 2. Network-Specific Settings
    
    #### API Endpoints
    \`\`\`bash
    # ${network.toUpperCase()} endpoints
    ${getNetworkEndpoints(network)}
    \`\`\`
    
    ### 3. Deployment Configuration
    
    Create \`deployments/${network}-plan.yaml\`:
    
    \`\`\`yaml
    ---
    id: 0
    name: ${network}-deployment
    network: ${network}
    stacks-node: "${getStacksNodeUrl(network)}"
    bitcoin-node: "${getBitcoinNodeUrl(network)}"
    plan:
      batches:
        - id: 0
          transactions:
            # Your deployment transactions will be added here
            # - contract-publish:
            #     contract-name: my-contract
            #     expected-sender: ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM
            #     cost: 50000
            #     path: contracts/my-contract.clar
    \`\`\`
    
    ### 4. Testing Configuration
    
    Update test configuration in \`tests/\`:
    
    \`\`\`typescript
    // Test configuration for ${network}
    export const testConfig = {
      network: "${network}",
      timeout: 30000,
      accounts: {
        deployer: "${getDefaultDeployer(network)}",
        wallet1: "${getDefaultWallet1(network)}",
        wallet2: "${getDefaultWallet2(network)}"
      },
      contracts: {
        // Your contract configurations
      }
    };
    \`\`\`
    
    ### 5. IDE Configuration
    
    #### VS Code Settings (\`.vscode/settings.json\`)
    \`\`\`json
    {
      "clarinet.enable": true,
      "clarinet.network": "${network}",
      "editor.formatOnSave": true,
      "[clarity]": {
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.rulers": [100]
      },
      "files.associations": {
        "*.clar": "clarity",
        "Clarinet.toml": "toml",
        "*.toml": "toml"
      },
      "emmet.includeLanguages": {
        "clarity": "lisp"
      }
    }
    \`\`\`
    
    ### 6. Development Workflow
    
    \`\`\`bash
    # 1. Start development environment
    clarinet console
    
    # 2. Interactive development commands
    > (contract-call? .my-contract some-function)
    > ::get_costs
    > ::get_contracts_by_trait
    > ::get_accounts
    
    # 3. Run tests for specific network
    clarinet test --${network}
    
    # 4. Deploy to network
    clarinet deployments generate --${network}
    clarinet deployments apply --${network}
    
    # 5. Monitor deployment
    clarinet deployments check --${network}
    \`\`\`
    
    ### 7. Security Configuration
    
    #### Network Security Settings
    \`\`\`toml
    # Add to your ${network} settings
    [security]
    enable_signers = true
    require_signatures = ${network === 'mainnet' ? 'true' : 'false'}
    max_contract_size = 1048576  # 1MB
    gas_limit = 15000000
    \`\`\`
    
    ### 8. Performance Optimization
    
    \`\`\`toml
    # Performance settings for ${network}
    [performance]
    parallel_testing = true
    cache_contracts = true
    optimize_builds = true
    cost_analysis = ${network === 'devnet' ? 'detailed' : 'summary'}
    \`\`\`
    
    ## Next Steps
    
    1. **Add Contracts**: Use \`generate_clarity_contract\` to add smart contracts
    2. **Write Tests**: Use \`generate_contract_tests\` for comprehensive testing
    3. **Configure CI/CD**: Set up automated testing and deployment
    4. **Monitor Performance**: Use cost analysis tools
    5. **Deploy**: Follow the deployment workflow for ${network}
    
    Your Clarinet project is now configured for ${network} development!`;
          
        } catch (error) {
          return `❌ Failed to configure project: ${error}`;
        }
      },
    };
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 the tool configures settings, adds dependencies, and sets up environments—implying mutation operations—but doesn't disclose critical behaviors like whether changes are reversible, permission requirements, side effects on existing configurations, or error handling. For a configuration tool with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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 front-loads the core purpose ('Configure Clarinet project settings') and lists key actions. There's no wasted text, and it's appropriately sized for the tool's scope. However, it could be slightly more structured (e.g., separating network configuration from dependency management) to enhance clarity, preventing a perfect score.

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 tool's complexity (configuration with potential side effects), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects like what 'configure' entails (e.g., file modifications, environment variables), how dependencies are added, or what the setup outcome looks like. For a mutation tool without structured safety or output information, the description should provide more context to be fully helpful.

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 fully documents both parameters ('network' with enum values and 'requirements' as an array). The description adds no additional meaning beyond what the schema provides—it mentions 'different networks' and 'dependencies' but doesn't clarify parameter usage, constraints, or examples. With high schema coverage, the baseline score of 3 is appropriate.

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 with specific verbs ('configure', 'add', 'set up') and resources ('Clarinet project settings', 'dependencies', 'development environment'). It distinguishes from siblings like 'generate_clarinet_project' (which creates rather than configures) and 'build_clarity_smart_contract' (which builds rather than configures). However, it doesn't explicitly differentiate from all siblings, keeping it at a 4 rather than a 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. It doesn't mention prerequisites (e.g., after generating a project), exclusions, or comparisons to siblings like 'generate_clarinet_project' (for initial setup) or environment-specific tools. Without any usage context, the agent must infer when this tool is appropriate.

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/exponentlabshq/stacks-clarity-mcp'

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