Skip to main content
Glama
blockscout

Blockscout MCP Server

Official

transaction_summary

Read-only

Generate human-readable transaction summaries from blockchain data to classify transfers, swaps, NFT sales, and DeFi operations for rapid comprehension and analysis.

Instructions

Get human-readable transaction summaries from Blockscout Transaction Interpreter.
Automatically classifies transactions into natural language descriptions (transfers, swaps, NFT sales, DeFi operations)
Essential for rapid transaction comprehension, dashboard displays, and initial analysis.
Note: Not all transactions can be summarized and accuracy is not guaranteed for complex patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chain_idYesThe ID of the blockchain
transaction_hashYesTransaction hash

Implementation Reference

  • The core handler function that executes the transaction_summary tool. It fetches the summary from Blockscout API, processes it, and returns a structured ToolResponse.
    @log_tool_invocation
    async def transaction_summary(
        chain_id: Annotated[str, Field(description="The ID of the blockchain")],
        transaction_hash: Annotated[str, Field(description="Transaction hash")],
        ctx: Context,
    ) -> ToolResponse[TransactionSummaryData]:
        """
        Get human-readable transaction summaries from Blockscout Transaction Interpreter.
        Automatically classifies transactions into natural language descriptions (transfers, swaps, NFT sales, DeFi operations)
        Essential for rapid transaction comprehension, dashboard displays, and initial analysis.
        Note: Not all transactions can be summarized and accuracy is not guaranteed for complex patterns.
        """  # noqa: E501
        api_path = f"/api/v2/transactions/{transaction_hash}/summary"
    
        await report_and_log_progress(
            ctx,
            progress=0.0,
            total=2.0,
            message=f"Starting to fetch transaction summary for {transaction_hash} on chain {chain_id}...",
        )
    
        base_url = await get_blockscout_base_url(chain_id)
    
        await report_and_log_progress(
            ctx, progress=1.0, total=2.0, message="Resolved Blockscout instance URL. Fetching transaction summary..."
        )
    
        response_data = await make_blockscout_request(base_url=base_url, api_path=api_path)
    
        await report_and_log_progress(ctx, progress=2.0, total=2.0, message="Successfully fetched transaction summary.")
    
        summary = response_data.get("data", {}).get("summaries")
    
        if summary is not None and not isinstance(summary, list):
            raise RuntimeError("Blockscout API returned an unexpected format for transaction summary")
    
        summary_data = TransactionSummaryData(summary=summary)
    
        return build_tool_response(data=summary_data)
  • Pydantic model defining the structure of the transaction summary data payload used in the tool response.
    class TransactionSummaryData(BaseModel):
        """A structured representation of a transaction summary."""
    
        summary: list[dict] | None = Field(
            None,
            description=(
                "List of summary objects for generating human-readable transaction descriptions, "
                "or null if no summary data is available."
            ),
        )
  • MCP tool registration where the transaction_summary function is registered with the FastMCP server.
        structured_output=False,
        annotations=create_tool_annotations("Get Transaction Summary"),
    )(transaction_summary)
  • REST API wrapper and route registration for the transaction_summary tool.
    async def transaction_summary_rest(request: Request) -> Response:
        """REST wrapper for the transaction_summary tool."""
        params = extract_and_validate_params(request, required=["chain_id", "transaction_hash"], optional=[])
        tool_response = await transaction_summary(**params, ctx=get_mock_context(request))
        return JSONResponse(tool_response.model_dump())
Behavior4/5

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

Annotations already provide readOnlyHint=true, destructiveHint=false, and openWorldHint=true, indicating a safe, read-only operation with potential for unknown data. The description adds valuable behavioral context beyond this: it discloses that 'Not all transactions can be summarized and accuracy is not guaranteed for complex patterns,' which is crucial for understanding limitations. However, it doesn't mention rate limits, authentication needs, or response format details.

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 efficiently structured with four sentences that each serve a distinct purpose: stating the core function, detailing classification capabilities, specifying use cases, and disclosing limitations. There's no wasted text, and key information is front-loaded, making it easy for an agent to quickly understand the tool's value.

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?

Given the tool's moderate complexity (2 required parameters), rich annotations (readOnlyHint, openWorldHint), and lack of output schema, the description is mostly complete. It covers purpose, usage, and limitations well. However, it doesn't describe the output format (e.g., what the summary looks like), which would be helpful since there's no output schema. The annotations help compensate, but some gaps remain.

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%, with both parameters (chain_id and transaction_hash) well-documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema, so it meets the baseline of 3. It doesn't compensate for gaps because there are none, but also doesn't provide extra semantic context.

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 clearly states the tool's purpose: 'Get human-readable transaction summaries from Blockscout Transaction Interpreter' with specific details about classification into natural language descriptions (transfers, swaps, NFT sales, DeFi operations). It distinguishes itself from sibling tools like 'get_transaction_info' by focusing on summarized, human-readable interpretations rather than raw transaction data.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool: 'Essential for rapid transaction comprehension, dashboard displays, and initial analysis.' It doesn't explicitly mention when NOT to use it or name specific alternatives, but the context strongly implies it's for summary purposes rather than detailed analysis, which differentiates it from siblings like 'get_transaction_info'.

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

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/blockscout/mcp-server'

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