Skip to main content
Glama

network_switch

Switch Hedera blockchain networks to configure SDK connections, mirror nodes, and RPC endpoints for development, testing, or production deployment.

Instructions

Switch between Hedera networks seamlessly.

NETWORKS: mainnet (production), testnet (testing), previewnet (preview), local (development) UPDATES: All SDK connections, Mirror Node URLs, RPC endpoints automatically

USE FOR: Multi-network development, testing across environments, production deployment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
networkYesTarget network

Implementation Reference

  • The core handler function that switches the Hedera network by executing the 'network use' command via hederaCLI service.
    export async function switchNetwork(args: {
      network: 'mainnet' | 'testnet' | 'previewnet' | 'local';
    }): Promise<ToolResult> {
      try {
        logger.info('Switching network', { network: args.network });
    
        const result = await hederaCLI.executeCommand({
          command: 'network use',
          args: {
            network: args.network,
          },
        });
    
        return result;
      } catch (error) {
        logger.error('Failed to switch network', { error });
        return {
          success: false,
          error: error instanceof Error ? error.message : 'Unknown error',
        };
      }
    }
  • src/index.ts:583-585 (registration)
    The switch case in the main tool execution handler that routes calls to the switchNetwork function.
    case 'network_switch':
      result = await switchNetwork(args as { network: 'mainnet' | 'testnet' | 'previewnet' | 'local' });
      break;
  • The tool schema definition used in optimizedToolDefinitions array, which is served via ListToolsRequest.
      {
        name: 'network_switch',
        description: `Switch between Hedera networks seamlessly.
    
    NETWORKS: mainnet (production), testnet (testing), previewnet (preview), local (development)
    UPDATES: All SDK connections, Mirror Node URLs, RPC endpoints automatically
    
    USE FOR: Multi-network development, testing across environments, production deployment.`,
        inputSchema: {
          type: 'object' as const,
          properties: {
            network: {
              type: 'string',
              enum: ['mainnet', 'testnet', 'previewnet', 'local'],
              description: 'Target network',
            },
          },
          required: ['network'],
        },
      },
  • The local tool definition in networkTools array exported from the network module.
      name: 'network_switch',
      description:
        'Switch to a different Hedera network. Available networks: mainnet (production), testnet (testing), previewnet (preview features), local (local development).',
      inputSchema: {
        type: 'object' as const,
        properties: {
          network: {
            type: 'string',
            description: 'Network to switch to',
            enum: ['mainnet', 'testnet', 'previewnet', 'local'],
          },
        },
        required: ['network'],
      },
    },
  • src/index.ts:30-30 (registration)
    Import statement that brings the switchNetwork handler into the main index.ts file.
    import { getCurrentNetwork, switchNetwork } from './tools/network.js';
Behavior4/5

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

With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it switches networks 'seamlessly', updates 'All SDK connections, Mirror Node URLs, RPC endpoints automatically', and lists the four target networks. It doesn't mention side effects like session persistence or error handling, but covers the core behavior adequately.

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 efficiently structured with three bullet-point sections (NETWORKS, UPDATES, USE FOR), each containing only essential information. Every sentence earns its place by clarifying scope, behavior, or usage without redundancy.

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

Completeness4/5

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

Given the tool's moderate complexity (network switching with automatic updates), no annotations, and no output schema, the description is mostly complete. It covers purpose, networks, updates, and usage, but lacks details on return values or error conditions, which would be helpful for an agent invoking it.

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 input schema has 100% description coverage with a clear enum and description for the single parameter 'network'. The description adds minimal value beyond the schema by listing the network options in parentheses, but doesn't provide additional semantic context like default behavior or implications of each choice.

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

Purpose5/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 ('Switch between Hedera networks') and resources ('SDK connections, Mirror Node URLs, RPC endpoints'), and distinguishes it from siblings like network_info by focusing on network switching rather than querying network status.

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

Usage Guidelines5/5

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

The description explicitly provides usage scenarios ('Multi-network development, testing across environments, production deployment'), giving clear guidance on when to use this tool versus alternatives like network_info for status checks or other tools for specific operations on a network.

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/justmert/hashpilot'

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