cairo-erc721
Generate ERC-721 non-fungible token smart contracts with customizable features like burnable tokens, pausable functionality, minting controls, and royalty management.
Instructions
Make a non-fungible token per the ERC-721 standard.
Returns the source code of the generated contract, formatted in a Markdown code block. Does not write to disk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the contract | |
| symbol | Yes | The short symbol for the token | |
| baseUri | No | A base uri for the non-fungible token. | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| mintable | No | Whether privileged accounts will be able to create more supply or emit more tokens | |
| enumerable | No | Whether to allow on-chain enumeration of all tokens or those owned by an account. Increases gas cost of transfers. | |
| votes | No | Whether to keep track of individual units for voting in on-chain governance. Voting durations can be expressed as block numbers or timestamps. | |
| royaltyInfo | No | Provides information for how much royalty is owed and to whom, based on a sale price. Follows ERC-2981 standard. | |
| appName | No | Required when votes is enabled, for hashing and signing typed structured data. Name for domain separator implementing SNIP12Metadata trait. Prevents two applications from producing the same hash. | |
| appVersion | No | Required when votes is enabled, for hashing and signing typed structured data. Version for domain separator implementing SNIP12Metadata trait. Prevents two versions of the same application from producing the same hash. | |
| access | No | The 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. | |
| upgradeable | No | Whether the smart contract is upgradeable. | |
| info | No | Metadata about the contract and author |
Implementation Reference
- The handler function for the 'cairo-erc721' tool. It receives input parameters, constructs an ERC721Options object, generates the Cairo contract code using the OpenZeppelin erc721 wizard, and returns it as text content.async ({ name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc721.print(opts)), }, ], }; },
- Zod schema defining the input shape and descriptions for the 'cairo-erc721' tool parameters.export const erc721Schema = { name: z.string().describe(commonDescriptions.name), symbol: z.string().describe(commonDescriptions.symbol), baseUri: z.string().optional().describe(cairoERC721Descriptions.baseUri), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), mintable: z.boolean().optional().describe(commonDescriptions.mintable), enumerable: z.boolean().optional().describe(cairoERC721Descriptions.enumerable), votes: z.boolean().optional().describe(cairoERC721Descriptions.votes), royaltyInfo: z .object({ enabled: z.boolean().describe(cairoRoyaltyInfoDescriptions.enabled), defaultRoyaltyFraction: z.string().describe(cairoRoyaltyInfoDescriptions.defaultRoyaltyFraction), feeDenominator: z.string().describe(cairoRoyaltyInfoDescriptions.feeDenominator), }) .optional() .describe(cairoCommonDescriptions.royaltyInfo), appName: z.string().optional().describe(cairoCommonDescriptions.appName), appVersion: z.string().optional().describe(cairoCommonDescriptions.appVersion), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/cairo/tools/erc721.ts:8-55 (registration)Specific registration function for the 'cairo-erc721' tool, called during Cairo tools initialization.export function registerCairoERC721(server: McpServer): RegisteredTool { return server.tool( 'cairo-erc721', makeDetailedPrompt(cairoPrompts.ERC721), erc721Schema, async ({ name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, burnable, pausable, mintable, enumerable, votes, royaltyInfo, appName, appVersion, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintCairoCodeBlock(() => erc721.print(opts)), }, ], }; }, ); }
- packages/mcp/src/cairo/tools.ts:17-34 (registration)Aggregator function that registers all Cairo tools, including 'cairo-erc721' via registerCairoERC721.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), }; } export function registerCairoTools(server: McpServer) { Object.values(getRegisterFunctions(server)).forEach(registerTool => { registerTool(server); }); }
- packages/mcp/src/server.ts:26-26 (registration)Top-level call to register all Cairo tools (including cairo-erc721) when creating the MCP server.registerCairoTools(server);