Skip to main content
Glama
OpenZeppelin

OpenZeppelin Contracts MCP Server

Official
by OpenZeppelin

cairo-custom

Generate custom smart contracts with OpenZeppelin Contracts libraries. Define contract name, access control, pausability, and upgradeability. Outputs source code in Markdown for easy integration without writing to disk.

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
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.
infoNoMetadata about the contract and author
nameYesThe name of the contract
pausableNoWhether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response.
upgradeableNoWhether the smart contract is upgradeable.

Implementation Reference

  • The handler function for the 'cairo-custom' tool. It constructs CustomOptions from input parameters (name, pausable, access, upgradeable, info) and generates Cairo code by calling custom.print(opts) from the @openzeppelin/wizard-cairo library, then returns it wrapped in a text content response using safePrintCairoCodeBlock.
    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 the input validation for the 'cairo-custom' tool, including required 'name', optional 'pausable', and spreads in commonSchema (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;
  • The registration of the 'cairo-custom' tool using server.tool(), specifying the name 'cairo-custom', a detailed prompt from cairoPrompts.Custom, the customSchema for input validation, and the 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)), }, ], }; }, ); }

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