Skip to main content
Glama

Inspect Contract Code

inspect_contract_code
Read-only

Inspects a verified contract's source code or metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressYesThe address of the smart contract.
chain_idYesThe ID of the blockchain.
file_nameNoThe name of the source file to inspect. If omitted, returns contract metadata and the list of source files.
session_idNoOpaque session identifier.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesThe main data payload of the tool's response.
notesNoA list of important contextual notes, such as warnings about data truncation or data quality issues.
paginationNoPagination information, present only if the 'data' is a single page of a larger result set.
content_textNoOptional human-readable summary used for MCP content responses.
instructionsNoA list of suggested follow-up actions or instructions for the LLM to plan its next steps.
data_descriptionNoA list of notes explaining the structure, fields, or conventions of the 'data' payload.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed1 schema field changed
    • addedInput schema / properties / session_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Opaque session identifier.",
      +  "title": "Session Id"
      +}
  2. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$defs": {
      +    "ContractMetadata": {
      +      "additionalProperties": true,
      +      "description": "Detailed metadata for a verified smart contract.",
      +      "properties": {
      +        "compiler_version": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The compiler version used.",
      +          "title": "Compiler Version"
      +        },
      +        "constructor_args": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The raw constructor arguments, possibly truncated.",
      +          "title": "Constructor Args"
      +        },
      +        "constructor_args_truncated": {
      +          "default": false,
      +          "description": "Indicates if constructor_args or decoded_constructor_args was truncated.",
      +          "title": "Constructor Args Truncated",
      +          "type": "boolean"
      +        },
      +        "decoded_constructor_args": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "additionalProperties": true,
      +              "type": "object"
      +            },
      +            {
      +              "items": {},
      +              "type": "array"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null,
      +          "description": "Decoded constructor arguments, if available.",
      +          "title": "Decoded Constructor Args"
      +        },
      +        "evm_version": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The EVM version target.",
      +          "title": "Evm Version"
      +        },
      +        "is_fully_verified": {
      +          "anyOf": [
      +            {
      +              "type": "boolean"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "Flag indicating if the contract is fully verified.",
      +          "title": "Is Fully Verified"
      +        },
      +        "language": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The programming language of the contract (e.g., Solidity, Vyper).",
      +          "title": "Language"
      +        },
      +        "license_type": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The license of the contract code (e.g., MIT, none).",
      +          "title": "License Type"
      +        },
      +        "name": {
      +          "description": "The name of the contract.",
      +          "title": "Name",
      +          "type": "string"
      +        },
      +        "optimization_enabled": {
      +          "anyOf": [
      +            {
      +              "type": "boolean"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "Flag indicating if compiler optimization was enabled.",
      +          "title": "Optimization Enabled"
      +        },
      +        "optimization_runs": {
      +          "anyOf": [
      +            {
      +              "type": "integer"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The number of optimization runs.",
      +          "title": "Optimization Runs"
      +        },
      +        "proxy_type": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The type of proxy if the contract is a proxy (e.g., basic_implementation).",
      +          "title": "Proxy Type"
      +        },
      +        "source_code_tree_structure": {
      +          "description": "A list of all source file paths for the contract.",
      +          "items": {
      +            "type": "string"
      +          },
      +          "title": "Source Code Tree Structure",
      +          "type": "array"
      +        },
      +        "verified_at": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "description": "The timestamp when the contract was verified.",
      +          "title": "Verified At"
      +        }
      +      },
      +      "required": [
      +        "name",
      +        "language",
      +        "compiler_version",
      +        "verified_at",
      +        "source_code_tree_structure",
      +        "optimization_enabled",
      +        "optimization_runs",
      +        "evm_version",
      +        "license_type",
      +        "proxy_type",
      +        "is_fully_verified",
      +        "constructor_args"
      +      ],
      +      "title": "ContractMetadata",
      +      "type": "object"
      +    },
      +    "ContractSourceFile": {
      +      "description": "Container for a single contract source file.",
      +      "properties": {
      +        "file_content": {
      +          "description": "The raw source code of the file.",
      +          "title": "File Content",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "file_content"
      +      ],
      +      "title": "ContractSourceFile",
      +      "type": "object"
      +    },
      +    "NextCallInfo": {
      +      "description": "A structured representation of the tool call required to get the next page.",
      +      "properties": {
      +        "params": {
      +          "additionalProperties": true,
      +          "description": "A complete dictionary of parameters for the next tool call, including the new cursor.",
      +          "title": "Params",
      +          "type": "object"
      +        },
      +        "tool_name": {
      +          "description": "The name of the tool to call for the next page.",
      +          "title": "Tool Name",
      +          "type": "string"
      +        }
      +      },
      +      "required": [
      +        "tool_name",
      +        "params"
      +      ],
      +      "title": "NextCallInfo",
      +      "type": "object"
      +    },
      +    "PaginationInfo": {
      +      "description": "Contains the structured information needed to retrieve the next page of results.",
      +      "properties": {
      +        "next_call": {
      +          "$ref": "#/$defs/NextCallInfo",
      +          "description": "The structured tool call required to fetch the subsequent page."
      +        }
      +      },
      +      "required": [
      +        "next_call"
      +      ],
      +      "title": "PaginationInfo",
      +      "type": "object"
      +    }
      +  },
      +  "properties": {
      +    "content_text": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Optional human-readable summary used for MCP content responses.",
      +      "title": "Content Text"
      +    },
      +    "data": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/$defs/ContractMetadata"
      +        },
      +        {
      +          "$ref": "#/$defs/ContractSourceFile"
      +        }
      +      ],
      +      "description": "The main data payload of the tool's response.",
      +      "title": "Data"
      +    },
      +    "data_description": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "A list of notes explaining the structure, fields, or conventions of the 'data' payload.",
      +      "title": "Data Description"
      +    },
      +    "instructions": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "A list of suggested follow-up actions or instructions for the LLM to plan its next steps.",
      +      "title": "Instructions"
      +    },
      +    "notes": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "type": "string"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "A list of important contextual notes, such as warnings about data truncation or data quality issues.",
      +      "title": "Notes"
      +    },
      +    "pagination": {
      +      "anyOf": [
      +        {
      +          "$ref": "#/$defs/PaginationInfo"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Pagination information, present only if the 'data' is a single page of a larger result set."
      +    }
      +  },
      +  "required": [
      +    "data"
      +  ],
      +  "title": "ToolResponse[Union[ContractMetadata, ContractSourceFile]]",
      +  "type": "object"
      +}
  3. First observed

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, covering safety. The description adds a 'verified' constraint, implying the contract must be verified to succeed. It does not mention behavior for unverified contracts or error cases, but this is acceptable given annotation coverage.

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?

A single, front-loaded sentence containing all essential information with no redundant words. Perfectly concise.

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

Completeness4/5

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

With full schema coverage, output schema, and safety annotations, the description sufficiently covers the tool's purpose. It could have benefited from a brief note about when to use this vs. get_contract_abi, but the core context is present.

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?

Schema description coverage is 100%, so the description need not elaborate parameters. The phrase 'or metadata' hints at the file_name optionality, but no additional semantic value is added beyond schema.

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

Purpose5/5

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

The description states a specific verb ('Inspects') and resource ('verified contract's source code or metadata'), clearly distinguishing it from siblings like get_contract_abi (which fetches ABI) and read_contract (which executes calls). The mention of 'verified' adds a key qualifier.

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?

Usage is implied: use when needing source code or metadata of a verified contract. However, it does not explicitly contrast with sibling tools like get_contract_abi or read_contract, nor does it provide when-not-to-use guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.1/5.0
Disambiguation5/5

Each tool targets a distinct blockchain resource or action (address, block, transaction, token, NFT, contract, chain, raw API, session init). Even though direct_api_call is a generic fallback, the specialized tools have clear, non-overlapping purposes, and the complementary nature of tools like get_token_transfers_by_address and get_transactions_by_address is explicitly documented.

Naming Consistency4/5

The majority of tools follow a consistent get_<resource> pattern (e.g., get_block_info, get_tokens_by_address), but there are notable deviations: direct_api_call, lookup_token_by_symbol, inspect_contract_code, read_contract, and __unlock_blockchain_analysis__. These verbs are still descriptive and readable, but the mix of 'get' with other verbs prevents a perfect 5.

Tool Count4/5

With 16 tools, the server is slightly above the ideal 3-15 range but not excessive. Each tool maps to a significant Blockscout API capability, and the count feels proportional to the breadth of blockchain data covered. It is heavier than a minimal toolkit but not bloated.

Completeness4/5

The tool set covers core exploration workflows: address info, block lookup, transaction details, token/NFT holdings, contract ABI/source inspection, and read-only contract calls. Minor gaps like a dedicated token-info-by-contract-address tool exist, but the direct_api_call fallback and get_address_info's token details mitigate these. The surface is comprehensive for a read-only blockchain explorer.