solidity-custom
Generate custom Solidity smart contracts with OpenZeppelin libraries. Specify contract name, pausable functions, access control, and upgradeability options. Outputs source code in Markdown format.
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 |
|---|---|---|---|
| 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. | |
| info | No | Metadata about the contract and author | |
| name | Yes | The name of the contract | |
| pausable | No | Whether privileged accounts will be able to pause specifically marked functionality. Useful for emergency response. | |
| 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. |
Implementation Reference
- The asynchronous handler function for the 'solidity-custom' tool. It constructs CustomOptions from input parameters and generates Solidity source code using OpenZeppelin's Wizard custom.print() function, then wraps it in a text content response.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 inputs for the 'solidity-custom' tool: name (required string), pausable (optional boolean), and common fields (access, upgradeable, info) from commonSchema.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)Registration function for the 'solidity-custom' tool, called by higher-level registries. Registers the tool name, detailed prompt from Wizard, input schema, and handler on the MCP server.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)), }, ], }; }, ); }