Skip to content

Refactor get_address_info to return structured response #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

akolotov
Copy link
Collaborator

Summary

  • add AddressInfoData to models
  • return ToolResponse[AddressInfoData] from get_address_info
  • update unit tests for new return type
  • update integration tests for structured response

Closes #74


https://chatgpt.com/codex/tasks/task_b_685c6870eed88323b13be15031bbaeb8

@akolotov akolotov requested a review from Copilot June 25, 2025 21:56
Copilot

This comment was marked as outdated.

@akolotov akolotov requested a review from Copilot June 25, 2025 22:14
Copilot

This comment was marked as outdated.

@akolotov akolotov requested a review from Copilot June 25, 2025 22:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors get_address_info to return a structured ToolResponse[AddressInfoData] instead of a plaintext string, and updates the models and tests accordingly.

  • Introduce AddressInfoData and update get_address_info to build and return a ToolResponse.
  • Update unit tests (test_address_tools.py, test_models.py) to assert on the new return type and fields.
  • Update integration test (test_address_tools_integration.py) to handle and validate the structured response.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
blockscout_mcp_server/models.py Add AddressInfoData model for structured address payload.
blockscout_mcp_server/tools/address_tools.py Change get_address_info to return ToolResponse[AddressInfoData] via build_tool_response.
tests/tools/test_address_tools.py Update unit tests to assert on ToolResponse and AddressInfoData.
tests/test_models.py Add tests for the new AddressInfoData model.
tests/integration/test_address_tools_integration.py Update integration test to validate structured response.
Comments suppressed due to low confidence (1)

tests/tools/test_address_tools.py:465

  • Add a unit test covering the case where the metadata API returns an addresses map that does not include the queried address key. Verify that result.data.metadata is None and result.notes remains None.
    ):

@akolotov akolotov merged commit 56cc739 into feat/structured-output-main Jun 25, 2025
6 checks passed
@akolotov akolotov deleted the codex/refactor-get_address_info-tool-to-return-toolresponse branch June 25, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant