Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-custom

Generate custom Cairo smart contracts with configurable features like access control, upgradeability, and pausability using OpenZeppelin Contracts libraries.

Instructions

Make a custom smart contract.

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
pausableNoWhether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response.
accessNoThe type of access control to provision. Ownable is a simple mechanism with a single account authorized for all privileged actions. Roles is a flexible mechanism with a separate role for each privileged action. A role can have many authorized accounts.
upgradeableNoWhether the smart contract is upgradeable.
infoNoMetadata about the contract and author

Implementation Reference

  • Handler function that processes inputs for the 'cairo-custom' tool, constructs CustomOptions, generates Cairo code using the external 'custom.print' function, and returns formatted text content.
    async ({ name, pausable, access, upgradeable, info }) => {
      const opts: CustomOptions = {
        name,
        pausable,
        access,
        upgradeable,
        info,
      };
      return {
        content: [
          {
            type: 'text',
            text: safePrintCairoCodeBlock(() => custom.print(opts)),
          },
        ],
      };
    },
  • Zod schema defining inputs for 'cairo-custom': required name, optional pausable, and common fields (access, upgradeable, info).
    export const customSchema = {
      name: z.string().describe(commonDescriptions.name),
      pausable: z.boolean().optional().describe(commonDescriptions.pausable),
      ...commonSchema,
    } as const satisfies z.ZodRawShape;
  • Registers the 'cairo-custom' tool on the MCP server with name, prompt, schema, and handler function.
    export function registerCairoCustom(server: McpServer): RegisteredTool {
      return server.tool(
        'cairo-custom',
        makeDetailedPrompt(cairoPrompts.Custom),
        customSchema,
        async ({ name, pausable, access, upgradeable, info }) => {
          const opts: CustomOptions = {
            name,
            pausable,
            access,
            upgradeable,
            info,
          };
          return {
            content: [
              {
                type: 'text',
                text: safePrintCairoCodeBlock(() => custom.print(opts)),
              },
            ],
          };
        },
      );
    }
  • Includes registerCairoCustom in the getRegisterFunctions map for 'Custom' kind, called by registerCairoTools.
      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),
      };
    }
  • Calls registerCairoTools during MCP server setup, which includes the cairo-custom tool.
    registerCairoTools(server);
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses that the tool 'Returns the source code... Does not write to disk' which clarifies the output format and persistence behavior. However, it doesn't mention security implications, execution requirements, error conditions, or what happens with invalid inputs. For a contract generation tool with significant security implications, this is a notable gap.

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 extremely concise with only two sentences, both of which add value. The first sentence states the core purpose, the second clarifies output format and persistence behavior. There's zero wasted text, and the most important information (what it does) comes first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of smart contract generation and the lack of annotations and output schema, the description is minimally adequate. It covers the basic purpose and output format but lacks crucial context about security implications, language/framework specifics (Cairo vs Solidity), error handling, and when to use this versus sibling tools. The 100% schema coverage helps, but for a tool with significant security and functional implications, more behavioral context would be valuable.

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 5 parameters thoroughly. The description adds no parameter-specific information beyond what's in the schema. The baseline of 3 is appropriate when the schema does all the parameter documentation work.

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' specifies the verb and resource. It distinguishes from siblings by focusing on custom contracts rather than predefined templates like ERC20 or ERC721. However, it doesn't explicitly contrast with 'solidity-custom' which appears to be a sibling tool for 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 no guidance on when to use this tool versus alternatives. With multiple sibling tools including 'solidity-custom' and various template-based contracts, there's no indication of when a custom contract is preferable to a predefined template, or when to choose Cairo over Solidity/other languages.

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