Skip to main content
Glama

deploy-contract

Deploy smart contracts to blockchain networks using bytecode, ABI, and constructor arguments for secure AI-powered blockchain interactions.

Instructions

Deploy a contract to the network, given bytecode, and constructor arguments

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
abiYes
argsYes
bytecodeYes

Implementation Reference

  • Handler function that parses inputs, calls wagmi's deployContract, returns transaction hash or error message.
    execute: async (_args) => {
      try {
        const abi = JSON.parse(_args.abi) as Abi
        const args = _args.args
        const bytecode = _args.bytecode as Hex
        const result = await deployContract(wagmiConfig, {
          abi,
          args,
          bytecode,
        })
        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: abi (string), args (array of strings), bytecode (string).
    parameters: z.object({
      abi: z.string(),
      args: z.string().array(),
      bytecode: z.string(),
    }),
  • Function that registers the 'deploy-contract' tool on the FastMCP server with full definition.
    export function registerDeployContractTools(server: FastMCP): void {
      server.addTool({
        name: "deploy-contract",
        description: "Deploy a contract to the network, given bytecode, and constructor arguments",
        parameters: z.object({
          abi: z.string(),
          args: z.string().array(),
          bytecode: z.string(),
        }),
        execute: async (_args) => {
          try {
            const abi = JSON.parse(_args.abi) as Abi
            const args = _args.args
            const bytecode = _args.bytecode as Hex
            const result = await deployContract(wagmiConfig, {
              abi,
              args,
              bytecode,
            })
            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,
                }
              ]
            }
          }
        },
      });
    };
  • Invocation of the registration function during server setup to add the tool.
    registerDeployContractTools(server);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions deployment but fails to describe critical behaviors like network effects (e.g., on-chain transaction, gas costs, irreversibility), error handling, or response format. This leaves significant gaps for a mutation tool with complex implications.

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 a single, efficient sentence that directly states the tool's purpose with no wasted words. It is front-loaded and appropriately sized for the complexity, making it easy to parse quickly.

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 (contract deployment with 3 parameters), lack of annotations, and no output schema, the description is insufficient. It misses critical context such as deployment outcomes, error scenarios, network requirements, and how it differs from sibling tools, making it incomplete for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate by explaining parameters. It lists 'bytecode' and 'constructor arguments' but omits 'abi', and provides no details on formats, constraints, or examples. This adds minimal value beyond the schema's property names, failing to address the coverage gap adequately.

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 action ('Deploy a contract') and the required inputs ('given bytecode, and constructor arguments'), distinguishing it from sibling tools like 'write-contract' or 'send-transaction'. However, it doesn't explicitly differentiate from 'write-contract' which might also involve contract interactions, leaving some ambiguity.

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 like 'write-contract' or 'send-transaction', nor does it mention prerequisites such as network connectivity or account authorization. It simply states what the tool does without contextual usage information.

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

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