Skip to main content
Glama

send-transaction

Facilitates secure blockchain transactions by sending data, value, and recipient details to networks through MCPilot, enabling AI-powered interactions without exposing private keys.

Instructions

Send transactions to networks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
toYes
valueNo

Implementation Reference

  • The main handler function that executes the transaction using wagmi's sendTransaction, handles errors, and returns the transaction hash or error message.
    execute: async (args) => { try { const to = args.to as Address const value = args.value ? BigInt(args.value) : undefined const data = args.data as Address const result = await sendTransaction(wagmiConfig, { to, value, data, }) 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: to (recipient address), value (optional ETH amount), data (optional calldata).
    parameters: z.object({ to: z.string(), value: z.coerce.number().optional(), data: z.string().optional(), }),
  • The server.addTool call within registerSendTransactionTools that defines name, description, schema, and handler for the tool.
    server.addTool({ name: "send-transaction", description: "Send transactions to networks", parameters: z.object({ to: z.string(), value: z.coerce.number().optional(), data: z.string().optional(), }), execute: async (args) => { try { const to = args.to as Address const value = args.value ? BigInt(args.value) : undefined const data = args.data as Address const result = await sendTransaction(wagmiConfig, { to, value, data, }) 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, } ] } } }, });
  • The invocation of registerSendTransactionTools on the main FastMCP server instance, effectively registering the tool.
    registerSendTransactionTools(server);

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/mcpilot'

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