Skip to main content
Glama

dev.send

Destructive

Sign and broadcast unsigned transactions from write tools directly onchain using a local private key. Intended for development testing.

Instructions

DEV ONLY — Sign and broadcast an unsigned transaction using a local private key (PK env var). For production, use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead of this tool. Takes the transaction object returned by any write.* tool and submits it onchain.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesTarget contract address
dataYesEncoded calldata (hex)
valueNoValue in wei (default '0')0
chain_idNoChain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
signerYes
txHashYes
statusYes
blockNumberYes
gasLimitYes
gasUsedYes

Implementation Reference

  • The main handler function for the 'dev.send' tool. It registers the tool with server.registerTool("dev.send", ...), defines inputSchema (to, data, value, chain_id), fetches the private key from env PK, validates inputs, estimates gas, sends the transaction via viem WalletClient, waits for receipt, and returns structured output (signer, txHash, status, blockNumber, gasLimit, gasUsed).
    export function registerSendTool(server: McpServer, chains: Record<ChainId, ChainConfig>) {
      server.registerTool(
        "dev.send",
        {
          annotations: {
            title: "Sign and Send Transaction",
            readOnlyHint: false,
            destructiveHint: true,
            idempotentHint: false,
            openWorldHint: true,
          },
          description:
            "DEV ONLY — Sign and broadcast an unsigned transaction using a local private key (PK env var). For production, use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead of this tool. Takes the transaction object returned by any write.* tool and submits it onchain.",
          outputSchema: DevSendOutput,
          inputSchema: {
            to: z.string().describe("Target contract address"),
            data: z.string().describe("Encoded calldata (hex)"),
            value: z.string().default("0").describe("Value in wei (default '0')"),
            chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
          },
        },
        async (params) => {
          try {
            const pk = process.env.PK;
            if (!pk) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "Error: PK not set. Either create a .env file with PK=0x... in the server directory, or set PK in your MCP client config env block. This tool is for development only — use a dedicated wallet MCP server for production.",
                  },
                ],
                isError: true,
              };
            }
    
            const validTo = validateAddress(params.to, "to");
            const calldata = validateHexCalldata(params.data, "data");
            const valueWei = parseWeiDecimalString(params.value, "value");
    
            const chain = VIEM_CHAINS[params.chain_id];
            const chainConfig = chains[params.chain_id as ChainId];
            if (!chainConfig) {
              return {
                content: [
                  { type: "text" as const, text: `Error: Unsupported chain ID ${params.chain_id}` },
                ],
                isError: true,
              };
            }
    
            const transport = http(chainConfig.rpcUrl);
            const account = privateKeyToAccount(pk as `0x${string}`);
            const wallet = createWalletClient({ account, chain, transport });
            const client = createPublicClient({ chain, transport });
    
            const gasEstimate = await client.estimateGas({
              account: account.address,
              to: validTo,
              data: calldata,
              value: valueWei,
            });
            const gasLimit = (gasEstimate * 120n) / 100n;
    
            const hash = await wallet.sendTransaction({
              to: validTo,
              data: calldata,
              value: valueWei,
              gas: gasLimit,
              chain,
            });
    
            const receipt = await client.waitForTransactionReceipt({ hash, timeout: 60_000 });
    
            const result = {
              signer: account.address,
              txHash: receipt.transactionHash,
              status: receipt.status,
              blockNumber: Number(receipt.blockNumber),
              gasLimit: Number(gasLimit),
              gasUsed: Number(receipt.gasUsed),
            };
    
            return {
              content: [
                {
                  type: "text" as const,
                  text: JSON.stringify(result, null, 2),
                },
              ],
              structuredContent: result,
            };
          } catch (err) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `Error: ${err instanceof Error ? err.message : String(err)}`,
                },
              ],
              isError: true,
            };
          }
        },
      );
    }
  • The DevSendOutput Zod schema defines the output shape: signer (string), txHash (string), status (string), blockNumber (number), gasLimit (number), gasUsed (number). Used as the outputSchema for the tool.
    export const DevSendOutput = z.object({
      signer: z.string(),
      txHash: z.string(),
      status: z.string(),
      blockNumber: z.number(),
      gasLimit: z.number(),
      gasUsed: z.number(),
    });
  • Inline inputSchema for the tool: to (string), data (string, hex calldata), value (string, default '0'), chain_id (number, default 8453). Defined via Zod in the tool registration call.
    inputSchema: {
      to: z.string().describe("Target contract address"),
      data: z.string().describe("Encoded calldata (hex)"),
      value: z.string().default("0").describe("Value in wei (default '0')"),
      chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
    },
  • Import of registerSendTool from './dev/send.js' in the central tool registration index.
    import { registerSendTool } from "./dev/send.js";
  • Invocation of registerSendTool(server, chains) to register the 'dev.send' tool.
    registerSendTool(server, chains);
Behavior4/5

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

Annotations already mark the tool as destructive and not idempotent. The description adds valuable context about the private key source (environment variable) and confirms that it submits onchain. No contradictions with annotations.

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?

Three concise sentences: one for core purpose, one for usage guidance, one for input context. No fluff, but the structure could be slightly improved by separating the 'DEV ONLY' emphasis more explicitly. Still efficient.

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?

The description covers purpose, input context, and usage constraints. An output schema exists but is not shown; the description does not explain return values, but given the presence of an output schema, this is acceptable. Could mention potential errors or gas implications, but overall adequate for a dev-only tool.

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 coverage is 100% with each parameter described. The description adds no parameter-specific information beyond the schema, only stating that the tool takes the transaction object from write.* tools, which is implicit from the schema. Baseline 3 is appropriate.

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 signs and broadcasts unsinged transactions using a local private key, explicitly marking it as DEV ONLY. This disambiguates it from the sibling write.* tools (which generate transactions) and from production wallet servers mentioned as alternatives.

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 advises using this tool only in development and suggests alternative dedicated wallet MCP servers (Fireblocks, Safe, Turnkey) for production. It also specifies that the input is the transaction object from any write.* tool, providing clear when-to-use guidance.

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/arcadia-finance/mcp-server'

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