Skip to content

Commit 3688136

Browse files
committed
fix: Remove unused resources and update README for clarity on EVM tools
1 parent 319da8f commit 3688136

18 files changed

Lines changed: 310 additions & 1041 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ bun dev
7979
| Name | Description |
8080
| ------------------------------------------------------------------ | ----------------------------------------------------- |
8181
| [`get_chain_info`](src/evm/modules/network/tools.ts) | Get information about an EVM network |
82-
| [`get_supported_networks`](src/evm/modules/network/tools.ts) | Get a list of supported EVM networks |
8382
| [`get_transaction`](src/evm/modules/transactions/tools.ts) | Get detailed information about a specific transaction |
8483
| [`get_transaction_receipt`](src/evm/modules/transactions/tools.ts) | Get a transaction receipt by its hash |
8584
| [`estimate_gas`](src/evm/modules/transactions/tools.ts) | Estimate the gas cost for a transaction |

src/evm/modules/blocks/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
22

33
import { registerBlockPrompts } from "./prompts.js"
4-
import { registerBlockResources } from "./resources.js"
4+
import { registerBlockTools } from "./tools.js"
55

66
export function registerBlocks(server: McpServer) {
77
registerBlockPrompts(server)
8-
registerBlockResources(server)
8+
registerBlockTools(server)
99
}

src/evm/modules/blocks/prompts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { networkSchema } from "../common/types.js"
66
export function registerBlockPrompts(server: McpServer) {
77
// Basic block explorer prompt
88
server.prompt(
9-
"explore_block",
10-
"Explore information about a specific block",
9+
"analyze_block",
10+
"Analyze a block and provide detailed information about its contents",
1111
{
1212
blockNumber: z
1313
.string()

src/evm/modules/blocks/resources.ts

Lines changed: 0 additions & 142 deletions
This file was deleted.

src/evm/modules/blocks/tools.ts

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
2+
import type { Hash } from "viem"
3+
import { z } from "zod"
4+
5+
import * as services from "@/evm/services/index.js"
6+
import { defaultNetworkParam } from "../common/types"
7+
8+
export function registerBlockTools(server: McpServer) {
9+
// Get block by hash for a specific network
10+
server.tool(
11+
"get_block_by_hash",
12+
"Get a block by hash",
13+
{
14+
blockHash: z.string().describe("The block hash to look up"),
15+
network: defaultNetworkParam
16+
},
17+
async ({ network, blockHash }) => {
18+
try {
19+
const block = await services.getBlockByHash(blockHash as Hash, network)
20+
return {
21+
content: [
22+
{
23+
type: "text",
24+
text: services.helpers.formatJson(block)
25+
}
26+
]
27+
}
28+
} catch (error) {
29+
return {
30+
content: [
31+
{
32+
type: "text",
33+
text: `Error fetching block with hash: ${error instanceof Error ? error.message : String(error)}`
34+
}
35+
]
36+
}
37+
}
38+
}
39+
)
40+
41+
// Get block by number for a specific network
42+
server.tool(
43+
"get_block_by_number",
44+
"Get a block by number",
45+
{
46+
blockNumber: z.string().describe("The block number to look up"),
47+
network: defaultNetworkParam
48+
},
49+
async ({ network, blockNumber }) => {
50+
try {
51+
const block = await services.getBlockByNumber(
52+
parseInt(blockNumber),
53+
network
54+
)
55+
return {
56+
content: [
57+
{
58+
type: "text",
59+
text: services.helpers.formatJson(block)
60+
}
61+
]
62+
}
63+
} catch (error) {
64+
return {
65+
content: [
66+
{
67+
type: "text",
68+
text: `Error fetching block: ${error instanceof Error ? error.message : String(error)}`
69+
}
70+
]
71+
}
72+
}
73+
}
74+
)
75+
76+
// Get latest block for a specific network
77+
server.tool(
78+
"get_latest_block",
79+
"Get the latest block",
80+
{
81+
network: defaultNetworkParam
82+
},
83+
async ({ network }) => {
84+
try {
85+
const block = await services.getLatestBlock(network)
86+
return {
87+
content: [
88+
{
89+
type: "text",
90+
text: services.helpers.formatJson(block)
91+
}
92+
]
93+
}
94+
} catch (error) {
95+
return {
96+
content: [
97+
{
98+
type: "text",
99+
text: `Error fetching latest block: ${error instanceof Error ? error.message : String(error)}`
100+
}
101+
]
102+
}
103+
}
104+
}
105+
)
106+
}

src/evm/modules/contracts/tools.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,7 @@ export function registerContractTools(server: McpServer) {
7474
.describe("The arguments to pass to the function"),
7575
network: defaultNetworkParam
7676
},
77-
async ({
78-
contractAddress,
79-
abi,
80-
functionName,
81-
args = [],
82-
network = "bsc"
83-
}) => {
77+
async ({ contractAddress, abi, functionName, args = [], network }) => {
8478
try {
8579
// Parse ABI if it's a string
8680
const parsedAbi = typeof abi === "string" ? JSON.parse(abi) : abi

src/evm/modules/network/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
22

33
import { registerNetworkPrompts } from "./prompts.js"
4-
import { registerNetworkResources } from "./resources.js"
54
import { registerNetworkTools } from "./tools.js"
65

76
export function registerNetwork(server: McpServer) {
87
registerNetworkPrompts(server)
9-
registerNetworkResources(server)
108
registerNetworkTools(server)
119
}

0 commit comments

Comments
 (0)