Skip to main content
Glama

send-transaction

Send blockchain transactions to recipients or smart contracts using MetaMask MCP, specifying recipients, values, gas fees, and chain IDs for secure execution.

Instructions

Send transactions to networks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesThe transaction recipient or contract address.
dataNoA contract hashed method call with encoded args.
valueNoValue in wei sent with this transaction.
maxFeePerGasNoTotal fee per gas in wei, inclusive of maxPriorityFeePerGas.
maxPriorityFeePerGasNoMax priority fee per gas in wei.
chainIdNoChain ID to validate against before sending transaction.

Implementation Reference

  • Handler function that executes the send-transaction tool by calling wagmi's sendTransaction, returning the transaction hash or error message.
    execute: async (args) => {
      try {
        const result = await sendTransaction(wagmiConfig, args);
        return {
          content: [
            {
              type: "text",
              text: JSONStringify({
                hash: result,
              }),
            },
          ],
        };
      }
      catch (error) {
        if (error instanceof TransactionExecutionError) {
          return {
            content: [
              {
                type: "text",
                text: error.cause.message,
              },
            ],
          };
        }
        return {
          content: [
            {
              type: "text",
              text: (error as Error).message,
            },
          ],
        };
      }
    },
  • Zod schema defining the input parameters for the send-transaction tool.
    parameters: z.object({
      to: Address.describe("The transaction recipient or contract address."),
      data: Address.optional().describe("A contract hashed method call with encoded args."),
      value: z.coerce.bigint().optional().describe("Value in wei sent with this transaction."),
      maxFeePerGas: z.coerce.bigint().optional().describe("Total fee per gas in wei, inclusive of maxPriorityFeePerGas."),
      maxPriorityFeePerGas: z.coerce.bigint().optional().describe("Max priority fee per gas in wei."),
      chainId: z.coerce.number().optional().describe("Chain ID to validate against before sending transaction."),
    }),
  • Function that registers the send-transaction tool with FastMCP server, defining name, description, schema, and handler.
    export function registerSendTransactionTools(server: FastMCP, wagmiConfig: Config): void {
      server.addTool({
        name: "send-transaction",
        description: "Send transactions to networks.",
        parameters: z.object({
          to: Address.describe("The transaction recipient or contract address."),
          data: Address.optional().describe("A contract hashed method call with encoded args."),
          value: z.coerce.bigint().optional().describe("Value in wei sent with this transaction."),
          maxFeePerGas: z.coerce.bigint().optional().describe("Total fee per gas in wei, inclusive of maxPriorityFeePerGas."),
          maxPriorityFeePerGas: z.coerce.bigint().optional().describe("Max priority fee per gas in wei."),
          chainId: z.coerce.number().optional().describe("Chain ID to validate against before sending transaction."),
        }),
        execute: async (args) => {
          try {
            const result = await sendTransaction(wagmiConfig, args);
            return {
              content: [
                {
                  type: "text",
                  text: JSONStringify({
                    hash: result,
                  }),
                },
              ],
            };
          }
          catch (error) {
            if (error instanceof TransactionExecutionError) {
              return {
                content: [
                  {
                    type: "text",
                    text: error.cause.message,
                  },
                ],
              };
            }
            return {
              content: [
                {
                  type: "text",
                  text: (error as Error).message,
                },
              ],
            };
          }
        },
      });
    };
  • Call to register the send-transaction tool as part of the central tools registration.
    registerSendTransactionTools(server, wagmiConfig);
  • src/index.ts:15-15 (registration)
    Top-level call to register all tools, including send-transaction.
    registerTools(server, wagmiConfig);
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 fails to disclose critical behavioral traits. It doesn't mention that this is a write/mutation operation (implied by 'send'), potential costs (gas fees), irreversible nature, network dependencies, or authentication requirements. The description adds no meaningful context beyond the basic action.

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?

Extremely concise with a single 4-word sentence that's front-loaded with the core action. There's zero wasted language or redundancy, making it easy to parse while still conveying the basic purpose.

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 transaction-sending tool with no annotations and no output schema, the description is inadequate. It doesn't explain what happens after sending (e.g., returns transaction hash, requires confirmation), error conditions, network requirements, or relationship to sibling tools. The agent would struggle to use this effectively without additional context.

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%, providing good documentation for all 6 parameters. The description adds no additional parameter semantics beyond what's in the schema, but with complete schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Send transactions to networks' clearly states the action (send) and target (transactions to networks), but it's vague about what kind of transactions and lacks differentiation from siblings like 'write-contract' or 'call'. It doesn't specify if this is for native token transfers, contract interactions, or both.

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 on when to use this tool versus alternatives like 'write-contract', 'call', or 'deploy-contract'. The description provides no context about prerequisites, network requirements, or typical use cases, leaving the agent to infer usage from parameter names alone.

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/Xiawpohr/metamask-mcp'

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