@openzeppelin/contracts-mcp 0.5.10 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +20 -1
  2. package/apps/cairo-account.html +20 -0
  3. package/apps/cairo-custom.html +20 -0
  4. package/apps/cairo-erc1155.html +20 -0
  5. package/apps/cairo-erc20.html +20 -0
  6. package/apps/cairo-erc721.html +20 -0
  7. package/apps/cairo-governor.html +20 -0
  8. package/apps/cairo-multisig.html +20 -0
  9. package/apps/cairo-vesting.html +20 -0
  10. package/apps/confidential-erc7984.html +20 -0
  11. package/apps/solidity-account.html +22 -0
  12. package/apps/solidity-custom.html +22 -0
  13. package/apps/solidity-erc1155.html +22 -0
  14. package/apps/solidity-erc20.html +22 -0
  15. package/apps/solidity-erc721.html +22 -0
  16. package/apps/solidity-governor.html +22 -0
  17. package/apps/solidity-rwa.html +22 -0
  18. package/apps/solidity-stablecoin.html +22 -0
  19. package/apps/stellar-fungible.html +20 -0
  20. package/apps/stellar-governor.html +20 -0
  21. package/apps/stellar-non-fungible.html +20 -0
  22. package/apps/stellar-stablecoin.html +20 -0
  23. package/apps/stellar-vault.html +20 -0
  24. package/apps/stylus-erc1155.html +20 -0
  25. package/apps/stylus-erc20.html +20 -0
  26. package/apps/stylus-erc721.html +20 -0
  27. package/apps/uniswap-hooks.html +20 -0
  28. package/dist/apps/register.d.ts +50 -0
  29. package/dist/apps/register.d.ts.map +1 -0
  30. package/dist/apps/register.js +129 -0
  31. package/dist/apps/register.js.map +1 -0
  32. package/dist/cairo/tools/account.d.ts.map +1 -1
  33. package/dist/cairo/tools/account.js +7 -9
  34. package/dist/cairo/tools/account.js.map +1 -1
  35. package/dist/cairo/tools/custom.d.ts.map +1 -1
  36. package/dist/cairo/tools/custom.js +7 -9
  37. package/dist/cairo/tools/custom.js.map +1 -1
  38. package/dist/cairo/tools/erc1155.d.ts.map +1 -1
  39. package/dist/cairo/tools/erc1155.js +7 -9
  40. package/dist/cairo/tools/erc1155.js.map +1 -1
  41. package/dist/cairo/tools/erc20.d.ts.map +1 -1
  42. package/dist/cairo/tools/erc20.js +7 -9
  43. package/dist/cairo/tools/erc20.js.map +1 -1
  44. package/dist/cairo/tools/erc721.d.ts.map +1 -1
  45. package/dist/cairo/tools/erc721.js +7 -9
  46. package/dist/cairo/tools/erc721.js.map +1 -1
  47. package/dist/cairo/tools/governor.d.ts.map +1 -1
  48. package/dist/cairo/tools/governor.js +7 -9
  49. package/dist/cairo/tools/governor.js.map +1 -1
  50. package/dist/cairo/tools/multisig.d.ts.map +1 -1
  51. package/dist/cairo/tools/multisig.js +7 -9
  52. package/dist/cairo/tools/multisig.js.map +1 -1
  53. package/dist/cairo/tools/vesting.d.ts.map +1 -1
  54. package/dist/cairo/tools/vesting.js +7 -9
  55. package/dist/cairo/tools/vesting.js.map +1 -1
  56. package/dist/cli.js +0 -0
  57. package/dist/confidential/tools/erc7984.d.ts.map +1 -1
  58. package/dist/confidential/tools/erc7984.js +7 -9
  59. package/dist/confidential/tools/erc7984.js.map +1 -1
  60. package/dist/server.d.ts.map +1 -1
  61. package/dist/server.js +5 -0
  62. package/dist/server.js.map +1 -1
  63. package/dist/solidity/tools/account.d.ts.map +1 -1
  64. package/dist/solidity/tools/account.js +7 -9
  65. package/dist/solidity/tools/account.js.map +1 -1
  66. package/dist/solidity/tools/custom.d.ts.map +1 -1
  67. package/dist/solidity/tools/custom.js +7 -9
  68. package/dist/solidity/tools/custom.js.map +1 -1
  69. package/dist/solidity/tools/erc1155.d.ts.map +1 -1
  70. package/dist/solidity/tools/erc1155.js +9 -9
  71. package/dist/solidity/tools/erc1155.js.map +1 -1
  72. package/dist/solidity/tools/erc20.d.ts.map +1 -1
  73. package/dist/solidity/tools/erc20.js +7 -9
  74. package/dist/solidity/tools/erc20.js.map +1 -1
  75. package/dist/solidity/tools/erc721.d.ts.map +1 -1
  76. package/dist/solidity/tools/erc721.js +9 -9
  77. package/dist/solidity/tools/erc721.js.map +1 -1
  78. package/dist/solidity/tools/governor.d.ts.map +1 -1
  79. package/dist/solidity/tools/governor.js +8 -9
  80. package/dist/solidity/tools/governor.js.map +1 -1
  81. package/dist/solidity/tools/rwa.d.ts +2 -2
  82. package/dist/solidity/tools/rwa.d.ts.map +1 -1
  83. package/dist/solidity/tools/rwa.js +7 -9
  84. package/dist/solidity/tools/rwa.js.map +1 -1
  85. package/dist/solidity/tools/stablecoin.d.ts.map +1 -1
  86. package/dist/solidity/tools/stablecoin.js +7 -9
  87. package/dist/solidity/tools/stablecoin.js.map +1 -1
  88. package/dist/stellar/tools/fungible.d.ts.map +1 -1
  89. package/dist/stellar/tools/fungible.js +7 -9
  90. package/dist/stellar/tools/fungible.js.map +1 -1
  91. package/dist/stellar/tools/governor.d.ts.map +1 -1
  92. package/dist/stellar/tools/governor.js +7 -9
  93. package/dist/stellar/tools/governor.js.map +1 -1
  94. package/dist/stellar/tools/non-fungible.d.ts.map +1 -1
  95. package/dist/stellar/tools/non-fungible.js +7 -9
  96. package/dist/stellar/tools/non-fungible.js.map +1 -1
  97. package/dist/stellar/tools/stablecoin.d.ts.map +1 -1
  98. package/dist/stellar/tools/stablecoin.js +7 -9
  99. package/dist/stellar/tools/stablecoin.js.map +1 -1
  100. package/dist/stellar/tools/vault.d.ts.map +1 -1
  101. package/dist/stellar/tools/vault.js +7 -9
  102. package/dist/stellar/tools/vault.js.map +1 -1
  103. package/dist/stylus/tools/erc1155.d.ts.map +1 -1
  104. package/dist/stylus/tools/erc1155.js +7 -9
  105. package/dist/stylus/tools/erc1155.js.map +1 -1
  106. package/dist/stylus/tools/erc20.d.ts.map +1 -1
  107. package/dist/stylus/tools/erc20.js +7 -9
  108. package/dist/stylus/tools/erc20.js.map +1 -1
  109. package/dist/stylus/tools/erc721.d.ts.map +1 -1
  110. package/dist/stylus/tools/erc721.js +7 -9
  111. package/dist/stylus/tools/erc721.js.map +1 -1
  112. package/dist/uniswap-hooks/tools/hooks.d.ts.map +1 -1
  113. package/dist/uniswap-hooks/tools/hooks.js +7 -9
  114. package/dist/uniswap-hooks/tools/hooks.js.map +1 -1
  115. package/dist/utils.d.ts +4 -15
  116. package/dist/utils.d.ts.map +1 -1
  117. package/dist/utils.js +15 -39
  118. package/dist/utils.js.map +1 -1
  119. package/package.json +6 -3
  120. package/src/apps/register.ts +152 -0
  121. package/src/cairo/tools/account.ts +10 -12
  122. package/src/cairo/tools/custom.ts +10 -12
  123. package/src/cairo/tools/erc1155.ts +10 -12
  124. package/src/cairo/tools/erc20.ts +10 -12
  125. package/src/cairo/tools/erc721.ts +10 -12
  126. package/src/cairo/tools/governor.ts +10 -12
  127. package/src/cairo/tools/multisig.ts +10 -12
  128. package/src/cairo/tools/vesting.ts +10 -12
  129. package/src/confidential/tools/erc7984.ts +11 -13
  130. package/src/server.ts +5 -0
  131. package/src/solidity/tools/account.ts +10 -12
  132. package/src/solidity/tools/custom.ts +10 -12
  133. package/src/solidity/tools/erc1155.ts +26 -13
  134. package/src/solidity/tools/erc20.ts +10 -12
  135. package/src/solidity/tools/erc721.ts +14 -12
  136. package/src/solidity/tools/governor.ts +12 -12
  137. package/src/solidity/tools/rwa.ts +12 -14
  138. package/src/solidity/tools/stablecoin.ts +10 -12
  139. package/src/stellar/tools/fungible.ts +10 -12
  140. package/src/stellar/tools/governor.ts +10 -12
  141. package/src/stellar/tools/non-fungible.ts +10 -12
  142. package/src/stellar/tools/stablecoin.ts +10 -12
  143. package/src/stellar/tools/vault.ts +10 -12
  144. package/src/stylus/tools/erc1155.ts +10 -12
  145. package/src/stylus/tools/erc20.ts +10 -12
  146. package/src/stylus/tools/erc721.ts +10 -12
  147. package/src/uniswap-hooks/tools/hooks.ts +10 -13
  148. package/src/utils.ts +15 -38
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { FungibleOptions } from '@openzeppelin/wizard-stellar';
3
3
  import { fungible } from '@openzeppelin/wizard-stellar';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stellarFungibleSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stellarPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStellarFungible(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stellar-fungible',
11
- makeDetailedPrompt(stellarPrompts.Fungible),
12
- stellarFungibleSchema,
13
+ {
14
+ description: makeDetailedPrompt(stellarPrompts.Fungible),
15
+ inputSchema: stellarFungibleSchema,
16
+ title: 'Stellar Fungible',
17
+ },
13
18
  async ({
14
19
  name,
15
20
  symbol,
@@ -38,14 +43,7 @@ export function registerStellarFungible(server: McpServer): RegisteredTool {
38
43
  info,
39
44
  explicitImplementations,
40
45
  };
41
- return {
42
- content: [
43
- {
44
- type: 'text',
45
- text: safePrintRustCodeBlock(() => fungible.print(opts)),
46
- },
47
- ],
48
- };
46
+ return wizardAppPrintResult(opts, () => fungible.print(opts), 'rust');
49
47
  },
50
48
  );
51
49
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { GovernorOptions } from '@openzeppelin/wizard-stellar';
3
3
  import { governor } from '@openzeppelin/wizard-stellar';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stellarGovernorSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stellarPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStellarGovernor(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stellar-governor',
11
- makeDetailedPrompt(stellarPrompts.Governor),
12
- stellarGovernorSchema,
13
+ {
14
+ description: makeDetailedPrompt(stellarPrompts.Governor),
15
+ inputSchema: stellarGovernorSchema,
16
+ title: 'Stellar Governor',
17
+ },
13
18
  async ({
14
19
  name,
15
20
  version,
@@ -36,14 +41,7 @@ export function registerStellarGovernor(server: McpServer): RegisteredTool {
36
41
  explicitImplementations,
37
42
  info,
38
43
  };
39
- return {
40
- content: [
41
- {
42
- type: 'text',
43
- text: safePrintRustCodeBlock(() => governor.print(opts)),
44
- },
45
- ],
46
- };
44
+ return wizardAppPrintResult(opts, () => governor.print(opts), 'rust');
47
45
  },
48
46
  );
49
47
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { NonFungibleOptions } from '@openzeppelin/wizard-stellar';
3
3
  import { nonFungible } from '@openzeppelin/wizard-stellar';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stellarNonFungibleSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stellarPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStellarNonFungible(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stellar-non-fungible',
11
- makeDetailedPrompt(stellarPrompts.NonFungible),
12
- stellarNonFungibleSchema,
13
+ {
14
+ description: makeDetailedPrompt(stellarPrompts.NonFungible),
15
+ inputSchema: stellarNonFungibleSchema,
16
+ title: 'Stellar Non-Fungible',
17
+ },
13
18
  async ({
14
19
  name,
15
20
  symbol,
@@ -40,14 +45,7 @@ export function registerStellarNonFungible(server: McpServer): RegisteredTool {
40
45
  info,
41
46
  explicitImplementations,
42
47
  };
43
- return {
44
- content: [
45
- {
46
- type: 'text',
47
- text: safePrintRustCodeBlock(() => nonFungible.print(opts)),
48
- },
49
- ],
50
- };
48
+ return wizardAppPrintResult(opts, () => nonFungible.print(opts), 'rust');
51
49
  },
52
50
  );
53
51
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { StablecoinOptions } from '@openzeppelin/wizard-stellar';
3
3
  import { stablecoin } from '@openzeppelin/wizard-stellar';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stellarStablecoinSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stellarPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStellarStablecoin(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stellar-stablecoin',
11
- makeDetailedPrompt(stellarPrompts.Stablecoin),
12
- stellarStablecoinSchema,
13
+ {
14
+ description: makeDetailedPrompt(stellarPrompts.Stablecoin),
15
+ inputSchema: stellarStablecoinSchema,
16
+ title: 'Stellar Stablecoin',
17
+ },
13
18
  async ({
14
19
  name,
15
20
  symbol,
@@ -40,14 +45,7 @@ export function registerStellarStablecoin(server: McpServer): RegisteredTool {
40
45
  explicitImplementations,
41
46
  info,
42
47
  };
43
- return {
44
- content: [
45
- {
46
- type: 'text',
47
- text: safePrintRustCodeBlock(() => stablecoin.print(opts)),
48
- },
49
- ],
50
- };
48
+ return wizardAppPrintResult(opts, () => stablecoin.print(opts), 'rust');
51
49
  },
52
50
  );
53
51
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { VaultOptions } from '@openzeppelin/wizard-stellar';
3
3
  import { vault } from '@openzeppelin/wizard-stellar';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stellarVaultSchema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stellarPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStellarVault(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stellar-vault',
11
- makeDetailedPrompt(stellarPrompts.Vault),
12
- stellarVaultSchema,
13
+ {
14
+ description: makeDetailedPrompt(stellarPrompts.Vault),
15
+ inputSchema: stellarVaultSchema,
16
+ title: 'Stellar Vault',
17
+ },
13
18
  async ({ name, symbol, decimalsOffset, pausable, upgradeable, access, explicitImplementations, info }) => {
14
19
  const opts: VaultOptions = {
15
20
  name,
@@ -21,14 +26,7 @@ export function registerStellarVault(server: McpServer): RegisteredTool {
21
26
  explicitImplementations,
22
27
  info,
23
28
  };
24
- return {
25
- content: [
26
- {
27
- type: 'text',
28
- text: safePrintRustCodeBlock(() => vault.print(opts)),
29
- },
30
- ],
31
- };
29
+ return wizardAppPrintResult(opts, () => vault.print(opts), 'rust');
32
30
  },
33
31
  );
34
32
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { ERC1155Options } from '@openzeppelin/wizard-stylus';
3
3
  import { erc1155 } from '@openzeppelin/wizard-stylus';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stylusERC1155Schema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stylusPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStylusERC1155(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stylus-erc1155',
11
- makeDetailedPrompt(stylusPrompts.ERC1155),
12
- stylusERC1155Schema,
13
+ {
14
+ description: makeDetailedPrompt(stylusPrompts.ERC1155),
15
+ inputSchema: stylusERC1155Schema,
16
+ title: 'Stylus ERC1155',
17
+ },
13
18
  async ({ name, burnable, supply, info }) => {
14
19
  const opts: ERC1155Options = {
15
20
  name,
@@ -17,14 +22,7 @@ export function registerStylusERC1155(server: McpServer): RegisteredTool {
17
22
  supply,
18
23
  info,
19
24
  };
20
- return {
21
- content: [
22
- {
23
- type: 'text',
24
- text: safePrintRustCodeBlock(() => erc1155.print(opts)),
25
- },
26
- ],
27
- };
25
+ return wizardAppPrintResult(opts, () => erc1155.print(opts), 'rust');
28
26
  },
29
27
  );
30
28
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { ERC20Options } from '@openzeppelin/wizard-stylus';
3
3
  import { erc20 } from '@openzeppelin/wizard-stylus';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stylusERC20Schema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stylusPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStylusERC20(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stylus-erc20',
11
- makeDetailedPrompt(stylusPrompts.ERC20),
12
- stylusERC20Schema,
13
+ {
14
+ description: makeDetailedPrompt(stylusPrompts.ERC20),
15
+ inputSchema: stylusERC20Schema,
16
+ title: 'Stylus ERC20',
17
+ },
13
18
  async ({ name, burnable, permit, flashmint, info }) => {
14
19
  const opts: ERC20Options = {
15
20
  name,
@@ -18,14 +23,7 @@ export function registerStylusERC20(server: McpServer): RegisteredTool {
18
23
  flashmint,
19
24
  info,
20
25
  };
21
- return {
22
- content: [
23
- {
24
- type: 'text',
25
- text: safePrintRustCodeBlock(() => erc20.print(opts)),
26
- },
27
- ],
28
- };
26
+ return wizardAppPrintResult(opts, () => erc20.print(opts), 'rust');
29
27
  },
30
28
  );
31
29
  }
@@ -1,15 +1,20 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { ERC721Options } from '@openzeppelin/wizard-stylus';
3
3
  import { erc721 } from '@openzeppelin/wizard-stylus';
4
- import { safePrintRustCodeBlock, makeDetailedPrompt } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { stylusERC721Schema } from '@openzeppelin/wizard-common/schemas';
6
6
  import { stylusPrompts } from '@openzeppelin/wizard-common';
7
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
7
8
 
8
9
  export function registerStylusERC721(server: McpServer): RegisteredTool {
9
- return server.tool(
10
+ return registerWizardAppTool(
11
+ server,
10
12
  'stylus-erc721',
11
- makeDetailedPrompt(stylusPrompts.ERC721),
12
- stylusERC721Schema,
13
+ {
14
+ description: makeDetailedPrompt(stylusPrompts.ERC721),
15
+ inputSchema: stylusERC721Schema,
16
+ title: 'Stylus ERC721',
17
+ },
13
18
  async ({ name, burnable, enumerable, info }) => {
14
19
  const opts: ERC721Options = {
15
20
  name,
@@ -17,14 +22,7 @@ export function registerStylusERC721(server: McpServer): RegisteredTool {
17
22
  enumerable,
18
23
  info,
19
24
  };
20
- return {
21
- content: [
22
- {
23
- type: 'text',
24
- text: safePrintRustCodeBlock(() => erc721.print(opts)),
25
- },
26
- ],
27
- };
25
+ return wizardAppPrintResult(opts, () => erc721.print(opts), 'rust');
28
26
  },
29
27
  );
30
28
  }
@@ -1,14 +1,19 @@
1
1
  import type { McpServer, RegisteredTool } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { hooks, type HooksOptions } from '@openzeppelin/wizard-uniswap-hooks';
3
3
  import { uniswapHooksHooksSchema } from '@openzeppelin/wizard-common/schemas';
4
- import { makeDetailedPrompt, safePrintSolidityCodeBlock } from '../../utils';
4
+ import { makeDetailedPrompt } from '../../utils';
5
5
  import { uniswapHooksPrompts } from '@openzeppelin/wizard-common';
6
+ import { registerWizardAppTool, wizardAppPrintResult } from '../../apps/register';
6
7
 
7
8
  export function registerUniswapHooks(server: McpServer): RegisteredTool {
8
- return server.tool(
9
+ return registerWizardAppTool(
10
+ server,
9
11
  'uniswap-hooks',
10
- makeDetailedPrompt(uniswapHooksPrompts.Hooks),
11
- uniswapHooksHooksSchema,
12
+ {
13
+ description: makeDetailedPrompt(uniswapHooksPrompts.Hooks),
14
+ inputSchema: uniswapHooksHooksSchema,
15
+ title: 'Uniswap Hooks',
16
+ },
12
17
  async ({
13
18
  hook,
14
19
  name,
@@ -35,15 +40,7 @@ export function registerUniswapHooks(server: McpServer): RegisteredTool {
35
40
  access,
36
41
  info,
37
42
  };
38
-
39
- return {
40
- content: [
41
- {
42
- type: 'text',
43
- text: safePrintSolidityCodeBlock(() => hooks.print(opts)),
44
- },
45
- ],
46
- };
43
+ return wizardAppPrintResult(opts, () => hooks.print(opts), 'solidity');
47
44
  },
48
45
  );
49
46
  }
package/src/utils.ts CHANGED
@@ -3,49 +3,26 @@ import { OptionsError as OptionsErrorCairo } from '@openzeppelin/wizard-cairo';
3
3
  import { OptionsError as OptionsErrorStylus } from '@openzeppelin/wizard-stylus';
4
4
  import { OptionsError as OptionsErrorStellar } from '@openzeppelin/wizard-stellar';
5
5
 
6
- function safePrintCodeBlock(printFn: () => string, syntaxHighlightingLanguage: string): string {
7
- try {
8
- return `\
6
+ /** Wraps contract source code in a Markdown code block with the given syntax highlighting. */
7
+ export function codeBlock(code: string, syntaxHighlightingLanguage: string): string {
8
+ return `\
9
9
  \`\`\`${syntaxHighlightingLanguage}
10
- ${printFn()}
10
+ ${code}
11
11
  \`\`\`
12
12
  `;
13
- } catch (e) {
14
- if (
15
- e instanceof OptionsErrorSolidity ||
16
- e instanceof OptionsErrorCairo ||
17
- e instanceof OptionsErrorStylus ||
18
- e instanceof OptionsErrorStellar
19
- ) {
20
- return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
21
- } else {
22
- return `Unexpected error: ${e}`;
23
- }
24
- }
25
13
  }
26
14
 
27
- /**
28
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `solidity`.
29
- * Or prints the error message if an error occurs.
30
- */
31
- export function safePrintSolidityCodeBlock(printFn: () => string): string {
32
- return safePrintCodeBlock(printFn, 'solidity');
33
- }
34
-
35
- /**
36
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `cairo`.
37
- * Or prints the error message if an error occurs.
38
- */
39
- export function safePrintCairoCodeBlock(printFn: () => string): string {
40
- return safePrintCodeBlock(printFn, 'cairo');
41
- }
42
-
43
- /**
44
- * Prints the contract source code, wrapped in a Markdown code block with syntax highlighting as `rust`.
45
- * Or prints the error message if an error occurs.
46
- */
47
- export function safePrintRustCodeBlock(printFn: () => string): string {
48
- return safePrintCodeBlock(printFn, 'rust');
15
+ /** Renders a failed contract print as Markdown, detailing per-field messages for Wizard options errors. */
16
+ export function formatPrintError(e: unknown): string {
17
+ if (
18
+ e instanceof OptionsErrorSolidity ||
19
+ e instanceof OptionsErrorCairo ||
20
+ e instanceof OptionsErrorStylus ||
21
+ e instanceof OptionsErrorStellar
22
+ ) {
23
+ return `${e.message}\n\n${JSON.stringify(e.messages, null, 2)}`;
24
+ }
25
+ return `Unexpected error: ${e}`;
49
26
  }
50
27
 
51
28
  /**