@aibtc/mcp-server 1.70.0 → 1.70.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.
@@ -225,8 +225,6 @@ export const TOOL_SKILL_MAP = {
225
225
  taproot_verify_cosig: "ordinals-p2p",
226
226
  taproot_multisig_guide: "ordinals-p2p",
227
227
  // identity skill — ERC-8004 on-chain agent identity
228
- register_identity: "identity",
229
- get_identity: "identity",
230
228
  identity_get_last_id: "identity",
231
229
  identity_get: "identity",
232
230
  identity_get_metadata: "identity",
@@ -238,12 +236,7 @@ export const TOOL_SKILL_MAP = {
238
236
  identity_unset_wallet: "identity",
239
237
  identity_transfer: "identity",
240
238
  // reputation skill — ERC-8004 on-chain agent reputation
241
- give_feedback: "reputation",
242
- get_reputation: "reputation",
243
239
  // validation skill — ERC-8004 on-chain agent validation
244
- request_validation: "validation",
245
- get_validation_status: "validation",
246
- get_validation_summary: "validation",
247
240
  // stackspot skill — stacking lottery pots
248
241
  stackspot_list_pots: "stackspot",
249
242
  stackspot_get_pot_state: "stackspot",
@@ -7,9 +7,8 @@
7
7
  *
8
8
  * Spec: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
9
9
  *
10
- * These primitives are shared across:
11
- * - src/tools/signing.tools.ts (btc_sign_message / btc_verify_message)
12
- * - src/tools/news.tools.ts (news_file_signal auth headers)
10
+ * Used by src/tools/signing.tools.ts (btc_sign_message / btc_verify_message)
11
+ * and the BIP-322-authenticated aibtc.com tools.
13
12
  */
14
13
  /**
15
14
  * BIP-322 tagged hash: SHA256(SHA256(tag) || SHA256(tag) || msg)
@@ -7,9 +7,8 @@
7
7
  *
8
8
  * Spec: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
9
9
  *
10
- * These primitives are shared across:
11
- * - src/tools/signing.tools.ts (btc_sign_message / btc_verify_message)
12
- * - src/tools/news.tools.ts (news_file_signal auth headers)
10
+ * Used by src/tools/signing.tools.ts (btc_sign_message / btc_verify_message)
11
+ * and the BIP-322-authenticated aibtc.com tools.
13
12
  */
14
13
  import { Transaction, Script, RawWitness, RawTx, } from "@scure/btc-signer";
15
14
  import { hashSha256Sync } from "@stacks/encryption";
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared helpers for ERC-8004 tool files.
3
3
  *
4
- * Extracted to avoid duplication between erc8004.tools.ts and reputation.tools.ts.
4
+ * Shared by identity.tools.ts and reputation.tools.ts.
5
5
  */
6
6
  /** Default read-only caller address per network (boot addresses) */
7
7
  export declare const DEFAULT_CALLER: Record<string, string>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared helpers for ERC-8004 tool files.
3
3
  *
4
- * Extracted to avoid duplication between erc8004.tools.ts and reputation.tools.ts.
4
+ * Shared by identity.tools.ts and reputation.tools.ts.
5
5
  */
6
6
  import { NETWORK } from "../config/networks.js";
7
7
  import { getWalletManager } from "../services/wallet-manager.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibtc/mcp-server",
3
- "version": "1.70.0",
3
+ "version": "1.70.1",
4
4
  "description": "Bitcoin-native MCP server for AI agents: BTC/STX wallets, DeFi yield, sBTC peg, NFTs, and x402 payments.",
5
5
  "mcpName": "io.github.aibtcdev/mcp-server",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  "skill"
25
25
  ],
26
26
  "engines": {
27
- "node": ">=18.0.0"
27
+ "node": ">=22"
28
28
  },
29
29
  "keywords": [
30
30
  "claude",
package/skill/SKILL.md CHANGED
@@ -4,7 +4,7 @@ description: Bitcoin L1 wallet for agents - check balances, send BTC, manage UTX
4
4
  license: MIT
5
5
  metadata:
6
6
  author: aibtcdev
7
- version: 1.70.0 # x-release-please-version
7
+ version: 1.70.1 # x-release-please-version
8
8
  npm: "@aibtc/mcp-server"
9
9
  github: https://github.com/aibtcdev/aibtc-mcp-server
10
10
  ---
@@ -283,8 +283,8 @@ Agent identity and reputation on Bitcoin and Stacks:
283
283
  - L0: Local agent key generation
284
284
  - L1: Dual-chain plain-message signatures (btc_sign_message + stacks_sign_message)
285
285
  - L2: X claim + BTC airdrop activation
286
- - L3: On-chain identity registration via ERC-8004 (register_identity)
287
- - L4: Reputation bootstrapping (get_reputation, give_feedback)
286
+ - L3: On-chain identity registration via ERC-8004 (identity_register)
287
+ - L4: Reputation bootstrapping (reputation_get_summary, reputation_give_feedback)
288
288
  - Active: 5-minute check-ins to maintain reputation and liveness
289
289
 
290
290
  See: [references/genesis-lifecycle.md](references/genesis-lifecycle.md)
@@ -20,8 +20,8 @@ Each level unlocks new capabilities and demonstrates increasing commitment to th
20
20
  | L0 | Unverified | Create wallet with `wallet_create` | Local (~/.aibtc/) |
21
21
  | L1 | Registered | Dual-chain signatures verified | aibtc.com KV |
22
22
  | L2 | Genesis | X claim verified + BTC airdrop | KV + Bitcoin chain |
23
- | L3 | On-Chain Identity | ERC-8004 registration via `register_identity` | Stacks blockchain |
24
- | L4 | Reputation | Initial reputation established via `give_feedback` | Stacks blockchain |
23
+ | L3 | On-Chain Identity | ERC-8004 registration via `identity_register` | Stacks blockchain |
24
+ | L4 | Reputation | Initial reputation established via `reputation_give_feedback` | Stacks blockchain |
25
25
  | Active | - | Regular heartbeats to `/api/heartbeat` | KV (lastActive, checkInCount) |
26
26
 
27
27
  ## L0 → L1: Registration
@@ -163,13 +163,13 @@ Once an agent reaches L2 Genesis, it can register a permanent on-chain identity
163
163
  ```
164
164
  "Register my agent identity on-chain"
165
165
  ```
166
- Uses `register_identity` - writes the agent's Bitcoin and Stacks addresses to a Stacks smart contract implementing ERC-8004. Returns a transaction ID.
166
+ Uses `identity_register` - writes the agent's Bitcoin and Stacks addresses to a Stacks smart contract implementing ERC-8004. Returns a transaction ID.
167
167
 
168
168
  2. **Verify registration**:
169
169
  ```
170
170
  "Get my on-chain identity info"
171
171
  ```
172
- Uses `get_identity` - reads the registered identity from the Stacks blockchain. Confirms the agent address is on-chain.
172
+ Uses `identity_get` - reads the registered identity from the Stacks blockchain. Confirms the agent address is on-chain.
173
173
 
174
174
  3. **Check transaction status**:
175
175
  ```
@@ -181,8 +181,8 @@ Uses `get_transaction_status` - confirms the registration transaction was includ
181
181
 
182
182
  | Tool | Description |
183
183
  |------|-------------|
184
- | `register_identity` | Register agent identity on Stacks blockchain |
185
- | `get_identity` | Read registered identity for an address |
184
+ | `identity_register` | Register agent identity on Stacks blockchain |
185
+ | `identity_get` | Read registered identity for an address |
186
186
 
187
187
  ## L3 → L4: Reputation Bootstrapping
188
188
 
@@ -199,36 +199,21 @@ After on-chain identity registration, agents can establish a reputation record.
199
199
  ```
200
200
  "What's my current reputation score?"
201
201
  ```
202
- Uses `get_reputation` - returns current score, feedback count, and summary. New agents start at a neutral baseline.
202
+ Uses `reputation_get_summary` - returns current score, feedback count, and summary. New agents start at a neutral baseline.
203
203
 
204
204
  2. **Give feedback to bootstrap ecosystem reputation**:
205
205
  ```
206
206
  "Submit positive feedback for agent SP1..."
207
207
  "Rate my interaction with the x402 inference service"
208
208
  ```
209
- Uses `give_feedback` - submits a signed reputation signal for another agent or service. Participation in the reputation system boosts your own visibility in the AX discovery chain.
210
-
211
- 3. **Request validation** (optional):
212
- ```
213
- "Request validation for my agent"
214
- ```
215
- Uses `request_validation` - asks the aibtc.com platform to validate agent behavior. Approved validations increase reputation score.
216
-
217
- 4. **Check validation status**:
218
- ```
219
- "What's the status of my validation request?"
220
- ```
221
- Uses `get_validation_status` - returns pending, approved, or rejected status.
209
+ Uses `reputation_give_feedback` - submits a signed reputation signal for another agent or service. Participation in the reputation system boosts your own visibility in the AX discovery chain.
222
210
 
223
211
  ### Reputation Tool Reference
224
212
 
225
213
  | Tool | Description |
226
214
  |------|-------------|
227
- | `get_reputation` | Get reputation score and summary |
228
- | `give_feedback` | Submit reputation signal for another agent |
229
- | `request_validation` | Request platform validation |
230
- | `get_validation_status` | Check validation request status |
231
- | `get_validation_summary` | Get full validation history |
215
+ | `reputation_get_summary` | Get reputation score and summary |
216
+ | `reputation_give_feedback` | Submit reputation signal for another agent |
232
217
 
233
218
  ## L4 → Active: Liveness & Inbox
234
219
 
@@ -354,8 +339,8 @@ the 100-sat sBTC x402 payment and settles it directly. See
354
339
  | Create wallet | `wallet_create`, `wallet_import` |
355
340
  | L0 → L1 Registration | `get_wallet_info`, `btc_sign_message`, `stacks_sign_message` |
356
341
  | L1 → L2 Genesis | External (X post + admin verification) |
357
- | L2 → L3 On-Chain Identity | `register_identity`, `get_identity`, `get_transaction_status` |
358
- | L3 → L4 Reputation | `get_reputation`, `give_feedback`, `request_validation` |
342
+ | L2 → L3 On-Chain Identity | `identity_register`, `identity_get`, `get_transaction_status` |
343
+ | L3 → L4 Reputation | `reputation_get_summary`, `reputation_give_feedback` |
359
344
  | Heartbeat loop | `btc_sign_message` |
360
345
  | Inbox reply | `btc_sign_message` |
361
346
  | Inbox send (pay a peer) | `send_inbox_message_direct` |
@@ -396,7 +381,7 @@ Agent: "Check my BTC balance"
396
381
  ### 4. Register On-Chain Identity (L2 → L3)
397
382
  ```
398
383
  Agent: "Register my agent identity on-chain"
399
- → register_identity
384
+ → identity_register
400
385
  → Result: txid: "0x1a2b3c...", pending confirmation
401
386
 
402
387
  Agent: "Check the status of transaction 0x1a2b3c..."
@@ -404,22 +389,22 @@ Agent: "Check the status of transaction 0x1a2b3c..."
404
389
  → Result: status: confirmed, block_height: 150000
405
390
 
406
391
  Agent: "Get my on-chain identity info"
407
- → get_identity
392
+ → identity_get
408
393
  → Result: btcAddress: bc1q..., stxAddress: SP..., registered: true, level = L3
409
394
  ```
410
395
 
411
396
  ### 5. Bootstrap Reputation (L3 → L4)
412
397
  ```
413
398
  Agent: "What's my current reputation score?"
414
- → get_reputation
399
+ → reputation_get_summary
415
400
  → Result: score: 0, feedbackCount: 0, status: "new"
416
401
 
417
402
  Agent: "Submit positive feedback for the x402 inference service SP1..."
418
- → give_feedback
403
+ → reputation_give_feedback
419
404
  → Result: txid: "0x2c3d4e...", feedback recorded
420
405
 
421
406
  Agent: "What's my reputation score now?"
422
- → get_reputation
407
+ → reputation_get_summary
423
408
  → Result: score: 1, feedbackCount: 1, status: "active", level = L4
424
409
  ```
425
410
 
@@ -206,7 +206,7 @@ Uses `pillar_unwind` - repays borrowed sBTC and withdraws collateral.
206
206
 
207
207
  - [Pillar Website](https://pillarbtc.com)
208
208
  - [Twitter @pillar_btc](https://x.com/pillar_btc)
209
- - [CLAUDE.md Pillar Section](../../CLAUDE.md#pillar-smart-wallet)
209
+ - [Pillar tool reference](../../docs/TOOLS.md)
210
210
 
211
211
  ---
212
212
 
@@ -1,21 +0,0 @@
1
- /**
2
- * ERC-8004 Identity and Reputation Tools
3
- *
4
- * These tools provide on-chain agent identity and reputation management:
5
- *
6
- * Identity Tools:
7
- * - register_identity: Register new agent identity on-chain
8
- * - get_identity: Get agent identity info (owner, URI, wallet)
9
- *
10
- * Reputation Tools:
11
- * - give_feedback: Submit feedback for an agent
12
- * - get_reputation: Get aggregated reputation score
13
- *
14
- * Validation Tools:
15
- * - request_validation: Request third-party validation
16
- * - get_validation_status: Check validation request status
17
- * - get_validation_summary: Get validation summary for agent
18
- */
19
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
- export declare function registerErc8004Tools(server: McpServer): void;
21
- //# sourceMappingURL=erc8004.tools.d.ts.map
@@ -1,329 +0,0 @@
1
- /**
2
- * ERC-8004 Identity and Reputation Tools
3
- *
4
- * These tools provide on-chain agent identity and reputation management:
5
- *
6
- * Identity Tools:
7
- * - register_identity: Register new agent identity on-chain
8
- * - get_identity: Get agent identity info (owner, URI, wallet)
9
- *
10
- * Reputation Tools:
11
- * - give_feedback: Submit feedback for an agent
12
- * - get_reputation: Get aggregated reputation score
13
- *
14
- * Validation Tools:
15
- * - request_validation: Request third-party validation
16
- * - get_validation_status: Check validation request status
17
- * - get_validation_summary: Get validation summary for agent
18
- */
19
- import { z } from "zod";
20
- import { NETWORK, getExplorerTxUrl } from "../config/networks.js";
21
- import { createJsonResponse, createErrorResponse } from "../utils/index.js";
22
- import { getWalletManager } from "../services/wallet-manager.js";
23
- import { Erc8004Service } from "../services/erc8004.service.js";
24
- import { resolveFee } from "../utils/fee.js";
25
- import { sponsoredSchema } from "./schemas.js";
26
- import { normalizeHex, getCallerAddress } from "../utils/erc8004-helpers.js";
27
- const MAX_METADATA_KEY_LENGTH = 128;
28
- const MAX_METADATA_VALUE_BYTES = 512;
29
- export function registerErc8004Tools(server) {
30
- const service = new Erc8004Service(NETWORK);
31
- // ==========================================================================
32
- // Identity Tools
33
- // ==========================================================================
34
- // Register identity
35
- server.registerTool("register_identity", {
36
- description: "Register a new agent identity on-chain using ERC-8004 identity registry. " +
37
- "Returns a transaction ID. Check the transaction result to get the assigned agent ID. " +
38
- "Requires an unlocked wallet.",
39
- inputSchema: {
40
- uri: z
41
- .string()
42
- .optional()
43
- .describe("URI pointing to agent metadata (IPFS, HTTP, etc.). Optional."),
44
- metadata: z
45
- .array(z.object({
46
- key: z.string().max(MAX_METADATA_KEY_LENGTH).describe("Metadata key (max 128 chars)"),
47
- value: z.string().describe("Metadata value as hex string (max 512 bytes)"),
48
- }))
49
- .optional()
50
- .describe("Array of metadata key-value pairs. Values must be hex-encoded buffers. Optional."),
51
- fee: z
52
- .string()
53
- .optional()
54
- .describe('Fee preset ("low", "medium", "high") or micro-STX amount. Optional.'),
55
- sponsored: sponsoredSchema,
56
- },
57
- }, async ({ uri, metadata, fee, sponsored }) => {
58
- try {
59
- const walletManager = getWalletManager();
60
- const account = walletManager.getActiveAccount();
61
- if (!account) {
62
- throw new Error("No active wallet. Please unlock your wallet first.");
63
- }
64
- // Parse metadata if provided
65
- let parsedMetadata;
66
- if (metadata && metadata.length > 0) {
67
- parsedMetadata = metadata.map((m) => {
68
- const normalized = normalizeHex(m.value, `metadata value for key "${m.key}"`);
69
- const buf = Buffer.from(normalized, "hex");
70
- if (buf.length > MAX_METADATA_VALUE_BYTES) {
71
- throw new Error(`metadata value for key "${m.key}" exceeds ${MAX_METADATA_VALUE_BYTES} bytes (got ${buf.length})`);
72
- }
73
- return { key: m.key, value: buf };
74
- });
75
- }
76
- const feeAmount = fee ? await resolveFee(fee, NETWORK, "contract_call") : undefined;
77
- const result = await service.registerIdentity(account, uri, parsedMetadata, feeAmount, sponsored);
78
- return createJsonResponse({
79
- success: true,
80
- txid: result.txid,
81
- message: "Identity registration transaction submitted. " +
82
- "Check transaction result to get your agent ID.",
83
- network: NETWORK,
84
- explorerUrl: getExplorerTxUrl(result.txid, NETWORK),
85
- });
86
- }
87
- catch (error) {
88
- return createErrorResponse(error);
89
- }
90
- });
91
- // Get identity
92
- server.registerTool("get_identity", {
93
- description: "Get agent identity information from ERC-8004 identity registry. " +
94
- "Returns owner address, URI, and wallet address if set.",
95
- inputSchema: {
96
- agentId: z.number().int().min(0).describe("Agent ID to look up"),
97
- },
98
- }, async ({ agentId }) => {
99
- try {
100
- const callerAddress = getCallerAddress();
101
- const identity = await service.getIdentity(agentId, callerAddress);
102
- if (!identity) {
103
- return createJsonResponse({
104
- success: false,
105
- agentId,
106
- message: "Agent ID not found",
107
- });
108
- }
109
- return createJsonResponse({
110
- success: true,
111
- agentId: identity.agentId,
112
- owner: identity.owner,
113
- uri: identity.uri || "(no URI set)",
114
- wallet: identity.wallet || "(no wallet set)",
115
- network: NETWORK,
116
- });
117
- }
118
- catch (error) {
119
- return createErrorResponse(error);
120
- }
121
- });
122
- // ==========================================================================
123
- // Reputation Tools
124
- // ==========================================================================
125
- // Give feedback
126
- server.registerTool("give_feedback", {
127
- description: "Submit feedback for an agent using ERC-8004 reputation registry. " +
128
- "Value is normalized to 18 decimals (WAD) internally for aggregation. " +
129
- "Requires an unlocked wallet.",
130
- inputSchema: {
131
- agentId: z.number().int().min(0).describe("Agent ID to give feedback for"),
132
- value: z
133
- .number()
134
- .int()
135
- .min(0)
136
- .describe("Feedback value (e.g., 5 for 5-star rating)"),
137
- decimals: z
138
- .number()
139
- .int()
140
- .min(0)
141
- .max(18)
142
- .describe("Decimals for the value (e.g., 0 for integer ratings)"),
143
- tag1: z.string().optional().describe("Optional tag 1 (max 64 chars)"),
144
- tag2: z.string().optional().describe("Optional tag 2 (max 64 chars)"),
145
- endpoint: z.string().optional().describe("Optional endpoint URL"),
146
- feedbackUri: z.string().optional().describe("Optional feedback URI"),
147
- feedbackHash: z
148
- .string()
149
- .optional()
150
- .describe("Optional feedback hash as hex string (32 bytes)"),
151
- fee: z
152
- .string()
153
- .optional()
154
- .describe('Fee preset ("low", "medium", "high") or micro-STX amount. Optional.'),
155
- sponsored: sponsoredSchema,
156
- },
157
- }, async ({ agentId, value, decimals, tag1, tag2, endpoint, feedbackUri, feedbackHash, fee, sponsored }) => {
158
- try {
159
- const walletManager = getWalletManager();
160
- const account = walletManager.getActiveAccount();
161
- if (!account) {
162
- throw new Error("No active wallet. Please unlock your wallet first.");
163
- }
164
- const hashBuffer = feedbackHash
165
- ? Buffer.from(normalizeHex(feedbackHash, "feedbackHash", 32), "hex")
166
- : undefined;
167
- const feeAmount = fee ? await resolveFee(fee, NETWORK, "contract_call") : undefined;
168
- const result = await service.giveFeedback(account, agentId, value, decimals, tag1, tag2, endpoint, feedbackUri, hashBuffer, feeAmount, sponsored);
169
- return createJsonResponse({
170
- success: true,
171
- txid: result.txid,
172
- message: "Feedback submitted successfully",
173
- agentId,
174
- value,
175
- decimals,
176
- network: NETWORK,
177
- explorerUrl: getExplorerTxUrl(result.txid, NETWORK),
178
- });
179
- }
180
- catch (error) {
181
- return createErrorResponse(error);
182
- }
183
- });
184
- // Get reputation
185
- server.registerTool("get_reputation", {
186
- description: "Get aggregated reputation summary for an agent from ERC-8004 reputation registry. " +
187
- "Returns average rating as a raw WAD string (18 decimals) and total feedback count.",
188
- inputSchema: {
189
- agentId: z.number().int().min(0).describe("Agent ID to get reputation for"),
190
- },
191
- }, async ({ agentId }) => {
192
- try {
193
- const callerAddress = getCallerAddress();
194
- const reputation = await service.getReputation(agentId, callerAddress);
195
- if (reputation.totalFeedback === 0) {
196
- return createJsonResponse({
197
- success: true,
198
- agentId,
199
- totalFeedback: 0,
200
- summaryValue: "0",
201
- summaryValueDecimals: 0,
202
- message: "No feedback yet for this agent",
203
- network: NETWORK,
204
- });
205
- }
206
- return createJsonResponse({
207
- success: true,
208
- agentId: reputation.agentId,
209
- totalFeedback: reputation.totalFeedback,
210
- summaryValue: reputation.summaryValue,
211
- summaryValueDecimals: reputation.summaryValueDecimals,
212
- network: NETWORK,
213
- });
214
- }
215
- catch (error) {
216
- return createErrorResponse(error);
217
- }
218
- });
219
- // ==========================================================================
220
- // Validation Tools
221
- // ==========================================================================
222
- // Request validation
223
- server.registerTool("request_validation", {
224
- description: "Request third-party validation for an agent using ERC-8004 validation registry. " +
225
- "The validator will be notified and can respond with a 0-100 score. " +
226
- "Requires an unlocked wallet and must be called by agent owner or approved operator.",
227
- inputSchema: {
228
- validator: z.string().describe("Stacks address of the validator"),
229
- agentId: z.number().int().min(0).describe("Agent ID to request validation for"),
230
- requestUri: z.string().describe("URI with validation request details"),
231
- requestHash: z.string().describe("Unique request hash as hex string (32 bytes)"),
232
- fee: z
233
- .string()
234
- .optional()
235
- .describe('Fee preset ("low", "medium", "high") or micro-STX amount. Optional.'),
236
- sponsored: sponsoredSchema,
237
- },
238
- }, async ({ validator, agentId, requestUri, requestHash, fee, sponsored }) => {
239
- try {
240
- const walletManager = getWalletManager();
241
- const account = walletManager.getActiveAccount();
242
- if (!account) {
243
- throw new Error("No active wallet. Please unlock your wallet first.");
244
- }
245
- const normalizedHash = normalizeHex(requestHash, "requestHash", 32);
246
- const hashBuffer = Buffer.from(normalizedHash, "hex");
247
- const feeAmount = fee ? await resolveFee(fee, NETWORK, "contract_call") : undefined;
248
- const result = await service.requestValidation(account, validator, agentId, requestUri, hashBuffer, feeAmount, sponsored);
249
- return createJsonResponse({
250
- success: true,
251
- txid: result.txid,
252
- message: "Validation request submitted successfully",
253
- validator,
254
- agentId,
255
- requestHash,
256
- network: NETWORK,
257
- explorerUrl: getExplorerTxUrl(result.txid, NETWORK),
258
- });
259
- }
260
- catch (error) {
261
- return createErrorResponse(error);
262
- }
263
- });
264
- // Get validation status
265
- server.registerTool("get_validation_status", {
266
- description: "Get the status of a validation request using ERC-8004 validation registry. " +
267
- "Returns validator, agent ID, response score (0-100), and response metadata.",
268
- inputSchema: {
269
- requestHash: z.string().describe("Request hash as hex string (32 bytes)"),
270
- },
271
- }, async ({ requestHash }) => {
272
- try {
273
- const callerAddress = getCallerAddress();
274
- const normalizedHash = normalizeHex(requestHash, "requestHash", 32);
275
- const hashBuffer = Buffer.from(normalizedHash, "hex");
276
- const status = await service.getValidationStatus(hashBuffer, callerAddress);
277
- if (!status) {
278
- return createJsonResponse({
279
- success: false,
280
- requestHash,
281
- message: "Validation request not found",
282
- network: NETWORK,
283
- });
284
- }
285
- return createJsonResponse({
286
- success: true,
287
- requestHash,
288
- validator: status.validator,
289
- agentId: status.agentId,
290
- response: status.response,
291
- responseHash: status.responseHash,
292
- tag: status.tag || "(no tag)",
293
- lastUpdate: status.lastUpdate,
294
- hasResponse: status.hasResponse,
295
- network: NETWORK,
296
- });
297
- }
298
- catch (error) {
299
- return createErrorResponse(error);
300
- }
301
- });
302
- // Get validation summary
303
- server.registerTool("get_validation_summary", {
304
- description: "Get validation summary for an agent using ERC-8004 validation registry. " +
305
- "Returns total validation count and average response score (0-100).",
306
- inputSchema: {
307
- agentId: z.number().int().min(0).describe("Agent ID to get validation summary for"),
308
- },
309
- }, async ({ agentId }) => {
310
- try {
311
- const callerAddress = getCallerAddress();
312
- const summary = await service.getValidationSummary(agentId, callerAddress);
313
- return createJsonResponse({
314
- success: true,
315
- agentId,
316
- count: summary.count,
317
- averageResponse: summary.avgResponse,
318
- message: summary.count === 0
319
- ? "No validations yet for this agent"
320
- : `${summary.count} validation(s) with average score ${summary.avgResponse}/100`,
321
- network: NETWORK,
322
- });
323
- }
324
- catch (error) {
325
- return createErrorResponse(error);
326
- }
327
- });
328
- }
329
- //# sourceMappingURL=erc8004.tools.js.map