Skip to content

Commit 56b50e7

Browse files
committed
Update chains-api mcp
1 parent 15ad0b0 commit 56b50e7

2 files changed

Lines changed: 12 additions & 25 deletions

File tree

mcp-tools.js

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function getToolDefinitions() {
125125
},
126126
{
127127
name: 'get_rpc_monitor',
128-
description: 'Get RPC monitor status (isMonitoring, lastUpdated) and endpoint health check results (working/total counts, per-endpoint latency and status) for all chains',
128+
description: 'Get RPC monitor status and summary endpoint health counts across all chains (without per-chain endpoint listing)',
129129
inputSchema: {
130130
type: 'object',
131131
properties: {},
@@ -290,24 +290,7 @@ function handleValidateChains() {
290290
function getStatusLabel(status, results) {
291291
if (status.isMonitoring) return 'Running';
292292
if (results.testedEndpoints > 0) return 'Completed';
293-
return 'Starting up…';
294-
}
295-
296-
function buildWorkingEndpointsSection(results) {
297-
const byChain = {};
298-
for (const r of results.results) {
299-
if (!byChain[r.chainId]) byChain[r.chainId] = { name: r.chainName, endpoints: [] };
300-
byChain[r.chainId].endpoints.push(r);
301-
}
302-
const lines = ['', '### Working Endpoints by Chain'];
303-
for (const [id, chain] of Object.entries(byChain)) {
304-
lines.push(`\n**${chain.name}** (chain ${id})`);
305-
for (const ep of chain.endpoints) {
306-
const block = ep.blockNumber == null ? '' : ` — block #${ep.blockNumber}`;
307-
lines.push(` - ${ep.url}${block}`);
308-
}
309-
}
310-
return lines;
293+
return 'Starting up...';
311294
}
312295

313296
function formatRpcMonitorStatus(status, results) {
@@ -321,6 +304,7 @@ function formatRpcMonitorStatus(status, results) {
321304
`- Total endpoints discovered: ${results.totalEndpoints}`,
322305
`- Endpoints tested: ${results.testedEndpoints}`,
323306
`- Working endpoints: ${results.workingEndpoints}`,
307+
'- Use `get_rpc_monitor_by_id` for per-chain endpoint details.',
324308
];
325309

326310
if (!status.isMonitoring && results.testedEndpoints === 0) {
@@ -329,11 +313,8 @@ function formatRpcMonitorStatus(status, results) {
329313
'> Monitoring has been started but has not completed a run yet. Check back shortly.',
330314
'> Use `get_rpc_monitor_by_id` with a chain ID once data is available.'
331315
);
332-
return lines.join('\n');
333-
}
334-
335-
if (results.results.length > 0) {
336-
lines.push(...buildWorkingEndpointsSection(results));
316+
} else {
317+
lines.push('', '> Per-chain endpoint lists are available via `get_rpc_monitor_by_id`.');
337318
}
338319

339320
return lines.join('\n');

tests/unit/mcp-tools.test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,10 @@ describe('MCP Tools - Shared Module', () => {
493493
totalEndpoints: 100,
494494
testedEndpoints: 50,
495495
workingEndpoints: 45,
496-
results: [],
496+
results: [
497+
{ chainId: 1, chainName: 'Ethereum', url: 'https://eth.rpc', status: 'working' },
498+
{ chainId: 137, chainName: 'Polygon', url: 'https://polygon.rpc', status: 'working' },
499+
],
497500
});
498501
vi.mocked(rpcMonitor.getMonitoringStatus).mockReturnValue({
499502
isMonitoring: true,
@@ -506,6 +509,9 @@ describe('MCP Tools - Shared Module', () => {
506509
expect(text).toContain('Running');
507510
expect(text).toContain('100');
508511
expect(text).toContain('45');
512+
expect(text).toContain('per-chain endpoint details');
513+
expect(text).not.toContain('https://eth.rpc');
514+
expect(text).not.toContain('https://polygon.rpc');
509515
});
510516
});
511517

0 commit comments

Comments
 (0)