solidity-erc1155
Generate ERC-1155 smart contract source code for creating semi-fungible or non-fungible tokens with customizable features like burnable, pausable, and upgradeable options.
Instructions
Make a non-fungible token per the ERC-1155 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 | |
| uri | Yes | The location of the metadata for the token. Clients will replace any instance of {id} in this string with the tokenId. | |
| 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 | |
| supply | No | Whether to keep track of total supply of tokens | |
| updatableUri | No | Whether privileged accounts will be able to set a new URI for all token types | |
| 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 |
Implementation Reference
- Handler function that executes the tool: constructs ERC1155Options from inputs, generates Solidity contract code using OpenZeppelin Wizard's erc1155.print(), and formats it safely as text content.async ({ name, uri, burnable, pausable, mintable, supply, updatableUri, access, upgradeable, info }) => { const opts: ERC1155Options = { name, uri, burnable, pausable, mintable, supply, updatableUri, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => erc1155.print(opts)), }, ], }; },
- Zod schema object defining the input parameters and validation for the solidity-erc1155 tool.export const erc1155Schema = { name: z.string().describe(commonDescriptions.name), uri: z.string().describe(solidityERC1155Descriptions.uri), burnable: z.boolean().optional().describe(commonDescriptions.burnable), pausable: z.boolean().optional().describe(commonDescriptions.pausable), mintable: z.boolean().optional().describe(commonDescriptions.mintable), supply: z.boolean().optional().describe(solidityERC1155Descriptions.supply), updatableUri: z.boolean().optional().describe(solidityERC1155Descriptions.updatableUri), ...commonSchema, } as const satisfies z.ZodRawShape;
- packages/mcp/src/solidity/tools/erc1155.ts:8-36 (registration)Registration function that registers the 'solidity-erc1155' tool on the MCP server with prompt, schema, and handler.export function registerSolidityERC1155(server: McpServer): RegisteredTool { return server.tool( 'solidity-erc1155', makeDetailedPrompt(solidityPrompts.ERC1155), erc1155Schema, async ({ name, uri, burnable, pausable, mintable, supply, updatableUri, access, upgradeable, info }) => { const opts: ERC1155Options = { name, uri, burnable, pausable, mintable, supply, updatableUri, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => erc1155.print(opts)), }, ], }; }, ); }
- packages/mcp/src/solidity/tools.ts:30-34 (registration)Higher-level registration function that registers all Solidity tools, including ERC1155 via getRegisterFunctions.export function registerSolidityTools(server: McpServer) { Object.values(getRegisterFunctions(server)).forEach(registerTool => { registerTool(server); }); }
- packages/mcp/src/server.ts:25-25 (registration)Invocation of Solidity tools registration during server creation.registerSolidityTools(server);