API-getNodeCountSnapshots
Retrieve historical snapshots of node count data from the RSS3 network to monitor network growth and analyze trends over time.
Instructions
Retrieve snapshots of Node count
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:108-127 (registration)Dynamically constructs the list of available tools, generating names like `${toolName}-${method.name}` truncated to 64 characters from the OpenAPI specifications. This is where "API-getNodeCountSnapshots" would be registered if present in the OpenAPI.
for (const mcpToolWithClient of mcpToolWithClients) { for (const [toolName, def] of Object.entries( mcpToolWithClient.mcpTools.tools, )) { for (const method of def.methods) { console.error("method", method); const toolNameWithMethod = `${toolName}-${method.name}`; const truncatedToolName = toolNameWithMethod.slice(0, 64); const trimmedDescription = method.description.split("Error")[0].trim(); tools.push({ name: truncatedToolName, description: trimmedDescription, inputSchema: { type: "object", properties: {}, }, }); } } } - index.js:150-223 (handler)The main tool execution handler for all dynamic API tools. For a tool like "API-getNodeCountSnapshots", it resolves the operation from openApiLookup[name] and calls client.executeOperation(operation, params), returning the JSON response data.
server.setRequestHandler(CallToolRequestSchema, async (request) => { // console.error("call tool", request.params); const { name, arguments: params } = request.params; console.error("name", name); if (name === "API-get-input-schema") { for (const mcpToolWithClient of mcpToolWithClients) { for (const [toolName, def] of Object.entries( mcpToolWithClient.mcpTools.tools, )) { for (const method of def.methods) { const toolNameWithMethod = `${toolName}-${method.name}`; const truncatedToolName = toolNameWithMethod.slice(0, 64); if (truncatedToolName === params.toolName) { return { content: [ { type: "text", text: JSON.stringify(method.inputSchema) }, ], }; } } } } throw new Error(`Method ${params.toolName} not found`); } // find operation const mcpToolWithClient = mcpToolWithClients.find( (t) => t.mcpTools.openApiLookup[name], ); if (!mcpToolWithClient) { throw new Error(`Method ${name} not found`); } const operation = mcpToolWithClient.mcpTools.openApiLookup[name]; // execute try { const response = await mcpToolWithClient.client.executeOperation( operation, params, ); return { content: [ { type: "text", // currently this is the only type that seems to be used by mcp server text: JSON.stringify(response.data), // TODO: pass through the http status code text? }, ], }; } catch (error) { console.error("Error in tool call", error); if (error instanceof HttpClientError) { console.error( "HttpClientError encountered, returning structured error", error, ); const data = error.data?.response?.data ?? error.data ?? {}; return { content: [ { type: "text", text: JSON.stringify({ status: "error", // TODO: get this from http status code? ...(typeof data === "object" ? data : { data: data }), }), }, ], }; } throw error; } }); - index.js:156-175 (schema)Special handler within the tool caller that provides the input schema for any dynamic tool, including "API-getNodeCountSnapshots", by returning JSON.stringify(method.inputSchema).
if (name === "API-get-input-schema") { for (const mcpToolWithClient of mcpToolWithClients) { for (const [toolName, def] of Object.entries( mcpToolWithClient.mcpTools.tools, )) { for (const method of def.methods) { const toolNameWithMethod = `${toolName}-${method.name}`; const truncatedToolName = toolNameWithMethod.slice(0, 64); if (truncatedToolName === params.toolName) { return { content: [ { type: "text", text: JSON.stringify(method.inputSchema) }, ], }; } } } } throw new Error(`Method ${params.toolName} not found`); } - index.js:78-84 (helper)Converts OpenAPI specs to MCP tools using OpenAPIToMCPConverter.convertToMCPTools(), creating the mcpTools.tools and openApiLookup used for registration and execution.
const mcpToolWithClients = converterWithClients.map((cwc) => { const mcpTools = cwc.converter.convertToMCPTools(); return { mcpTools, client: cwc.client, }; }); - index.js:71-77 (helper)Initializes OpenAPIToMCPConverter and HttpClient for each OpenAPI spec fetched from RSS3 endpoints.
const converterWithClients = openApiSpecs.map((o) => { const converter = new OpenAPIToMCPConverter(o.spec); return { converter, client: o.client, }; });