Skip to main content
Glama
lienhage

Blockchain MCP Server

by lienhage

Static Call

static-call

Perform read-only smart contract calls on EVM-compatible chains to retrieve data without altering the blockchain state. Supports Ethereum, Polygon, BSC, and more.

Instructions

Make a static call to a smart contract on any EVM-compatible chain (read-only)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blockTagNoBlock tag (latest, earliest, pending, or block number)latest
chainYesChain identifier. Available: ethereum, polygon, bsc, arbitrum, optimism, avalanche, fantom, sepolia
dataYesABI-encoded function call data
toYesContract address to call

Implementation Reference

  • Handler function that performs the static call to the contract using the ethers JsonRpcProvider.
          async ({ chain, to, data, blockTag = "latest" }) => {
            try {
              const chainConfig = DEFAULT_CHAINS[chain.toLowerCase()];
              if (!chainConfig) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Unsupported chain "${chain}". Available chains: ${Object.keys(DEFAULT_CHAINS).join(', ')}`
                  }],
                  isError: true
                };
              }
    
              if (!ethers.isAddress(to)) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Invalid contract address: ${to}`
                  }],
                  isError: true
                };
              }
    
              const provider = this.providers.get(chain.toLowerCase());
              if (!provider) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Provider not initialized for chain: ${chain}`
                  }],
                  isError: true
                };
              }
    
              const result = await provider.call({
                to: to,
                data: data
              });
    
              return {
                content: [{
                  type: "text",
                  text: `Static call result:
    
    šŸ”— Chain: ${chainConfig.name} (${chainConfig.chainId})
    šŸ“„ Contract: ${to}
    šŸ“Š Call Data: ${data}
    šŸ·ļø Block: ${blockTag}
    
    šŸ“¤ Result: ${result}
    
    ${chainConfig.explorerUrl ? `šŸ” Explorer: ${chainConfig.explorerUrl}/address/${to}` : ''}`
                }]
              };
            } catch (error) {
              return {
                content: [{
                  type: "text",
                  text: `Error making static call: ${error instanceof Error ? error.message : String(error)}`
                }],
                isError: true
              };
            }
          }
  • Input schema using Zod for validating chain, contract address, call data, and optional block tag.
      chain: z.string().describe(`Chain identifier. Available: ${Object.keys(DEFAULT_CHAINS).join(', ')}`),
      to: z.string().describe("Contract address to call"),
      data: z.string().describe("ABI-encoded function call data"),
      blockTag: z.string().optional().describe("Block tag (latest, earliest, pending, or block number)").default("latest")
    }
  • Registers the 'static-call' tool with the MCP server, providing schema and handler.
        server.registerTool(
          "static-call",
          {
            title: "Static Call",
            description: "Make a static call to a smart contract on any EVM-compatible chain (read-only)",
            inputSchema: {
              chain: z.string().describe(`Chain identifier. Available: ${Object.keys(DEFAULT_CHAINS).join(', ')}`),
              to: z.string().describe("Contract address to call"),
              data: z.string().describe("ABI-encoded function call data"),
              blockTag: z.string().optional().describe("Block tag (latest, earliest, pending, or block number)").default("latest")
            }
          },
          async ({ chain, to, data, blockTag = "latest" }) => {
            try {
              const chainConfig = DEFAULT_CHAINS[chain.toLowerCase()];
              if (!chainConfig) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Unsupported chain "${chain}". Available chains: ${Object.keys(DEFAULT_CHAINS).join(', ')}`
                  }],
                  isError: true
                };
              }
    
              if (!ethers.isAddress(to)) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Invalid contract address: ${to}`
                  }],
                  isError: true
                };
              }
    
              const provider = this.providers.get(chain.toLowerCase());
              if (!provider) {
                return {
                  content: [{
                    type: "text",
                    text: `Error: Provider not initialized for chain: ${chain}`
                  }],
                  isError: true
                };
              }
    
              const result = await provider.call({
                to: to,
                data: data
              });
    
              return {
                content: [{
                  type: "text",
                  text: `Static call result:
    
    šŸ”— Chain: ${chainConfig.name} (${chainConfig.chainId})
    šŸ“„ Contract: ${to}
    šŸ“Š Call Data: ${data}
    šŸ·ļø Block: ${blockTag}
    
    šŸ“¤ Result: ${result}
    
    ${chainConfig.explorerUrl ? `šŸ” Explorer: ${chainConfig.explorerUrl}/address/${to}` : ''}`
                }]
              };
            } catch (error) {
              return {
                content: [{
                  type: "text",
                  text: `Error making static call: ${error instanceof Error ? error.message : String(error)}`
                }],
                isError: true
              };
            }
          }
        );
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It clearly states the tool is 'read-only', which is crucial for safety, and specifies it works on 'any EVM-compatible chain', indicating broad compatibility. However, it lacks details on rate limits, error handling, or response format, which are important for a tool with no output schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads key information: the action ('Make a static call'), target ('smart contract'), scope ('any EVM-compatible chain'), and critical behavior ('read-only'). Every word earns its place with zero waste, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (interacting with smart contracts on multiple chains) and lack of annotations and output schema, the description is moderately complete. It covers the core purpose and safety ('read-only') but omits details on response format, error cases, or chain-specific nuances, which could help an agent use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so all parameters are documented in the schema. The description adds minimal value beyond the schema by mentioning 'EVM-compatible chain' (relevant to the 'chain' parameter) and 'read-only' (context for all parameters). This meets the baseline for high schema coverage but doesn't provide additional semantic insights.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Make a static call to a smart contract on any EVM-compatible chain (read-only)'. It specifies the verb ('Make a static call'), resource ('smart contract'), and scope ('any EVM-compatible chain'), but doesn't explicitly differentiate from sibling tools like 'send-transaction' or 'get-balance', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context through 'read-only' and 'EVM-compatible chain', suggesting this is for querying contract state without transactions. However, it doesn't explicitly state when to use this tool versus alternatives like 'send-transaction' (for write operations) or 'get-balance' (for simple balance checks), leaving some ambiguity.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lienhage/blockchain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server