solidity-erc721
Generate ERC-721 NFT contract source code with customizable features like minting, burning, pausing, and access control. Returns formatted Solidity code without writing to disk.
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 token | |
| enumerable | No | Whether to allow on-chain enumeration of all tokens or those owned by an account. Increases gas cost of transfers. | |
| uriStorage | No | Allows updating token URIs for individual token IDs | |
| 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 | |
| incremental | No | Whether new tokens will be automatically assigned an incremental id | |
| 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 (defaulting to block number if not specified). | |
| 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. Managed enables a central contract to define a policy that allows certain callers to access certain functions. | |
| upgradeable | No | Whether the smart contract is upgradeable. Transparent uses more complex proxy with higher overhead, requires less changes in your contract. Can also be used with beacons. UUPS uses simpler proxy with less overhead, requires including extra code in your contract. Allows flexibility for authorizing upgrades. | |
| info | No | Metadata about the contract and author | |
| namespacePrefix | No | The prefix for ERC-7201 namespace identifiers. It should be derived from the project name or a unique naming convention specific to the project. Used only if the contract includes storage variables and upgradeability is enabled. Default is "myProject". |
Implementation Reference
- packages/mcp/src/solidity/tools/erc721.ts:8-55 (registration)Registration of the solidity-erc721 tool, including the name, prompt, schema reference, and inline handler function that generates the ERC721 contract code.export function registerSolidityERC721(server: McpServer): RegisteredTool { return server.tool( 'solidity-erc721', makeDetailedPrompt(solidityPrompts.ERC721), erc721Schema, async ({ name, symbol, baseUri, enumerable, uriStorage, burnable, pausable, mintable, incremental, votes, access, upgradeable, namespacePrefix, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, enumerable, uriStorage, burnable, pausable, mintable, incremental, votes, access, upgradeable, namespacePrefix, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => erc721.print(opts)), }, ], }; }, ); }
- The handler function that constructs ERC721Options from input parameters and uses OpenZeppelin Wizard's erc721.print(opts) to generate the Solidity contract source code, wrapped safely and returned as text content.async ({ name, symbol, baseUri, enumerable, uriStorage, burnable, pausable, mintable, incremental, votes, access, upgradeable, namespacePrefix, info, }) => { const opts: ERC721Options = { name, symbol, baseUri, enumerable, uriStorage, burnable, pausable, mintable, incremental, votes, access, upgradeable, namespacePrefix, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => erc721.print(opts)), }, ], }; },
- Zod schema defining the input parameters for the solidity-erc721 tool, including name, symbol, various ERC721-specific options, common options, and namespacePrefix.export const erc721Schema = { name: z.string().describe(commonDescriptions.name), symbol: z.string().describe(commonDescriptions.symbol), baseUri: z.string().optional().describe(solidityERC721Descriptions.baseUri), enumerable: z.boolean().optional().describe(solidityERC721Descriptions.enumerable), uriStorage: z.boolean().optional().describe(solidityERC721Descriptions.uriStorage), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), mintable: z.boolean().optional().describe(commonDescriptions.mintable), incremental: z.boolean().optional().describe(solidityERC721Descriptions.incremental), votes: z.literal('blocknumber').or(z.literal('timestamp')).optional().describe(solidityERC721Descriptions.votes), ...commonSchema, namespacePrefix: z.string().optional().describe(solidityCommonDescriptions.namespacePrefix), } as const satisfies z.ZodRawShape;
- packages/mcp/src/solidity/tools.ts:17-28 (registration)Intermediate registration mapping where registerSolidityERC721 is included in the list of Solidity tools to be registered.function getRegisterFunctions(server: McpServer): SolidityToolRegisterFunctions { return { ERC20: () => registerSolidityERC20(server), ERC721: () => registerSolidityERC721(server), ERC1155: () => registerSolidityERC1155(server), Stablecoin: () => registerSolidityStablecoin(server), RealWorldAsset: () => registerSolidityRWA(server), Account: () => registerSolidityAccount(server), Governor: () => registerSolidityGovernor(server), Custom: () => registerSolidityCustom(server), }; }
- packages/mcp/src/server.ts:25-25 (registration)Top-level call to register all Solidity tools, including solidity-erc721 via the chain.registerSolidityTools(server);