web3_clientVersion
Identify the client version of an EVM-compatible blockchain node to verify software compatibility and ensure proper network interaction.
Instructions
Returns the current client version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:100-126 (handler)The handler function for the 'web3_clientVersion' tool. It calls the generic makeRPCCall helper with the method name to execute the RPC request, formats the result using formatResponse, and returns it as a text content response. Includes error handling.server.tool( "web3_clientVersion", "Returns the current client version", {}, async () => { try { const result = await makeRPCCall("web3_clientVersion"); return { content: [ { type: "text", text: formatResponse(result, "Web3 Client Version"), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } }, );
- src/index.ts:89-96 (helper)Generic helper function used by the web3_clientVersion tool (and others) to perform RPC calls via the ethers JsonRpcProvider.async function makeRPCCall(method: string, params: any[] = []): Promise<any> { try { const result = await provider.send(method, params); return result; } catch (error: any) { throw new Error(`RPC call failed: ${error.message}`); } }
- src/index.ts:100-126 (registration)Registration of the 'web3_clientVersion' tool using server.tool, including name, description, empty input schema, and handler function.server.tool( "web3_clientVersion", "Returns the current client version", {}, async () => { try { const result = await makeRPCCall("web3_clientVersion"); return { content: [ { type: "text", text: formatResponse(result, "Web3 Client Version"), }, ], }; } catch (error: any) { return { content: [ { type: "text", text: `Error: ${error.message}`, }, ], }; } }, );
- src/index.ts:103-103 (schema)Empty input schema for the web3_clientVersion tool (no parameters required).{},