Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-account

Generate custom smart contract code for Starknet or Ethereum-flavored accounts that validate transactions, execute interactions, and support features like upgradeability and external execution.

Instructions

Make a custom smart contract that represents an account that can be deployed and interacted with other contracts, and can be extended to implement custom logic. An account is a special type of contract that is used to validate and execute transactions.

Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the contract
typeYesType of signature used for signature checking by the Account contract, Starknet account uses the STARK curve, Ethereum-flavored account uses the Secp256k1 curve.
declareNoWhether to enable the account to declare other contract classes.
deployNoWhether to enables the account to be counterfactually deployed.
pubkeyNoWhether to enables the account to change its own public key.
outsideExecutionNoWhether to allow a protocol to submit transactions on behalf of the account, as long as it has the relevant signatures.
upgradeableNoWhether the smart contract is upgradeable.
infoNoMetadata about the contract and author

Implementation Reference

  • The core handler function for the 'cairo-account' tool. It receives input parameters, constructs AccountOptions, calls the external account.print(opts) to generate Cairo code, formats it safely, and returns it as text content.
    async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info }) => {
      const opts: AccountOptions = {
        name,
        type,
        declare,
        deploy,
        pubkey,
        outsideExecution,
        upgradeable,
        info,
      };
      return {
        content: [
          {
            type: 'text',
            text: safePrintCairoCodeBlock(() => account.print(opts)),
          },
        ],
      };
    },
  • Zod schema defining the input parameters and validation for the 'cairo-account' tool.
    export const accountSchema = {
      name: z.string().describe(commonDescriptions.name),
      type: z.enum(['stark', 'eth']).describe(cairoAccountDescriptions.type),
      declare: z.boolean().optional().describe(cairoAccountDescriptions.declare),
      deploy: z.boolean().optional().describe(cairoAccountDescriptions.deploy),
      pubkey: z.boolean().optional().describe(cairoAccountDescriptions.pubkey),
      outsideExecution: z.boolean().optional().describe(cairoAccountDescriptions.outsideExecution),
      upgradeable: commonSchema.upgradeable,
      info: commonSchema.info,
    } as const satisfies z.ZodRawShape;
  • Registration of the 'cairo-account' tool via server.tool(), specifying name, prompt generator, schema, and handler function.
    export function registerCairoAccount(server: McpServer): RegisteredTool {
      return server.tool(
        'cairo-account',
        makeDetailedPrompt(cairoPrompts.Account),
        accountSchema,
        async ({ name, type, declare, deploy, pubkey, outsideExecution, upgradeable, info }) => {
          const opts: AccountOptions = {
            name,
            type,
            declare,
            deploy,
            pubkey,
            outsideExecution,
            upgradeable,
            info,
          };
          return {
            content: [
              {
                type: 'text',
                text: safePrintCairoCodeBlock(() => account.print(opts)),
              },
            ],
          };
        },
      );
    }
  • In getRegisterFunctions, the 'Account' entry that triggers registration of 'cairo-account' tool when registerCairoTools is called.
    function getRegisterFunctions(server: McpServer): CairoToolRegisterFunctions {
      return {
        ERC20: () => registerCairoERC20(server),
        ERC721: () => registerCairoERC721(server),
        ERC1155: () => registerCairoERC1155(server),
        Account: () => registerCairoAccount(server),
        Multisig: () => registerCairoMultisig(server),
        Governor: () => registerCairoGovernor(server),
        Vesting: () => registerCairoVesting(server),
        Custom: () => registerCairoCustom(server),
  • Top-level call to registerCairoTools in createServer(), which registers all Cairo tools including 'cairo-account'.
    registerCairoTools(server);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool returns source code in a Markdown code block and does not write to disk, which clarifies output format and non-persistence. However, it lacks critical behavioral details: it doesn't mention whether this is a read-only generation tool or if it interacts with a blockchain (e.g., deploys contracts), potential rate limits, authentication needs, or error handling. For a tool with 8 parameters and no annotations, this is a significant gap.

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?

The description is appropriately concise and front-loaded: the first sentence defines the tool's core purpose, and the second clarifies output behavior. Both sentences earn their place by adding value—explaining what an account is and specifying the return format. However, it could be slightly more structured by explicitly separating purpose from output details.

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 (8 parameters, no annotations, no output schema), the description is incomplete. It lacks context on how the generated contract integrates with other tools (e.g., deployment or interaction), prerequisites (e.g., blockchain environment), or error cases. While it covers output format, it doesn't address the broader usage scenario, making it inadequate for a tool with this level of parameter richness and no structured behavioral hints.

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%, so the schema already documents all 8 parameters thoroughly (e.g., 'type' with enum values explained, boolean flags like 'declare' and 'deploy' with clear purposes). The description adds no parameter-specific information beyond what the schema provides, such as examples or interactions between parameters. This meets the baseline of 3 for high schema coverage, but doesn't enhance understanding.

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 tool's purpose: 'Make a custom smart contract that represents an account that can be deployed and interacted with other contracts.' It specifies the verb ('Make'), resource ('custom smart contract'), and type ('account'), distinguishing it from non-account sibling tools like erc20 or governor. However, it doesn't explicitly differentiate from the sibling 'solidity-account' tool, which likely serves a similar purpose in a different language/framework.

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 minimal guidance on when to use this tool. It mentions that accounts 'can be extended to implement custom logic,' which implies usage for custom account implementations, but offers no explicit when-to-use criteria, alternatives (e.g., vs. 'solidity-account' or 'cairo-multisig'), or exclusions. Without such context, users must infer usage from the tool name and parameters 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/OpenZeppelin/contracts-wizard'

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