stylus-erc721
Generate ERC-721 compliant NFT smart contracts using OpenZeppelin libraries. Configure token properties like burnability and enumerability, then receive formatted source code.
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 | |
| burnable | No | Whether token holders will be able to destroy their tokens | |
| enumerable | No | Whether to allow on-chain enumeration of all tokens or those owned by an account. Increases gas cost of transfers. | |
| info | No | Metadata about the contract and author |
Implementation Reference
- The handler function that executes the tool logic: takes input options and generates the ERC721 Stylus Rust code using erc721.print.async ({ name, burnable, enumerable, info }) => { const opts: ERC721Options = { name, burnable, enumerable, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => erc721.print(opts)), }, ], }; },
- Zod schema for input validation of the stylus-erc721 tool parameters.export const erc721Schema = { name: z.string().describe(commonDescriptions.name), burnable: z.boolean().optional().describe(commonDescriptions.burnable), enumerable: z.boolean().optional().describe(stylusERC721Descriptions.enumerable), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/stylus/tools/erc721.ts:8-30 (registration)Registration of the 'stylus-erc721' tool with the MCP server, including name, prompt, schema, and handler.export function registerStylusERC721(server: McpServer): RegisteredTool { return server.tool( 'stylus-erc721', makeDetailedPrompt(stylusPrompts.ERC721), erc721Schema, async ({ name, burnable, enumerable, info }) => { const opts: ERC721Options = { name, burnable, enumerable, info, }; return { content: [ { type: 'text', text: safePrintRustCodeBlock(() => erc721.print(opts)), }, ], }; }, ); }