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.

  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. Changed13 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • removedInput schema / additionalProperties
      Removed value: -false
    • changedInput schema / properties / address / description
      Previous value: -"Smart contract address"New value: +"The address of the smart contract."
    • addedInput schema / properties / address / title
      Added value: +"Address"
    • changedInput schema / properties / chain_id / description
      Previous value: -"The ID of the blockchain"New value: +"The ID of the blockchain."
    • addedInput schema / properties / chain_id / title
      Added value: +"Chain Id"
    • addedInput schema / properties / file_name / anyOf
      Added value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / properties / file_name / default
      Added value: +null
    • changedInput schema / properties / file_name / description
      Previous value: -"Source file to inspect. If omitted returns metadata."New value: +"The name of the source file to inspect. If omitted, returns contract metadata and the list of source files."
    • addedInput schema / properties / file_name / title
      Added value: +"File Name"
    • removedInput schema / properties / file_name / type
      Removed value: -"string"
    • addedInput schema / title
      Added value: +"inspect_contract_codeArguments"
    • 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. Changed12 schema fields changed
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / address / description
      Previous value: -"The address of the smart contract."New value: +"Smart contract address"
    • removedInput schema / properties / address / title
      Removed value: -"Address"
    • changedInput schema / properties / chain_id / description
      Previous value: -"The ID of the blockchain."New value: +"The ID of the blockchain"
    • removedInput schema / properties / chain_id / title
      Removed value: -"Chain Id"
    • removedInput schema / properties / file_name / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / file_name / default
      Removed value: -null
    • changedInput schema / properties / file_name / description
      Previous value: -"The name of the source file to inspect. If omitted, returns contract metadata and the list of source files."New value: +"Source file to inspect. If omitted returns metadata."
    • removedInput schema / properties / file_name / title
      Removed value: -"File Name"
    • addedInput schema / properties / file_name / type
      Added value: +"string"
    • removedInput schema / title
      Removed value: -"inspect_contract_codeArguments"
  4. 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.