solidity-custom
Generate custom smart contract source code with configurable features like access control, upgradeability, and pausability using OpenZeppelin Contracts libraries.
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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The name of the contract | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| 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
- The handler function for the 'solidity-custom' tool. It constructs CustomOptions from inputs and generates Solidity code using @openzeppelin/wizard's custom.print, returning it as text content.async ({ name, pausable, access, upgradeable, info }) => { const opts: CustomOptions = { name, pausable, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => custom.print(opts)), }, ], };
- Zod schema defining the input parameters for the 'solidity-custom' tool: name (required), pausable (optional), and common fields (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;
- packages/mcp/src/solidity/tools/custom.ts:8-31 (registration)Registers the 'solidity-custom' MCP tool with the server, providing name, prompt, schema, and handler.export function registerSolidityCustom(server: McpServer): RegisteredTool { return server.tool( 'solidity-custom', makeDetailedPrompt(solidityPrompts.Custom), customSchema, async ({ name, pausable, access, upgradeable, info }) => { const opts: CustomOptions = { name, pausable, access, upgradeable, info, }; return { content: [ { type: 'text', text: safePrintSolidityCodeBlock(() => custom.print(opts)), }, ], }; }, ); }
- packages/mcp/src/solidity/tools.ts:26-26 (registration)Includes the custom tool registration in the Solidity tools aggregator function getRegisterFunctions.Custom: () => registerSolidityCustom(server),
- packages/mcp/src/server.ts:25-25 (registration)Calls registerSolidityTools in the main server creation, which indirectly registers the 'solidity-custom' tool.registerSolidityTools(server);