Skip to content

tests: Add unit tests for mcp_tool #663

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

pkduongsu
Copy link

@pkduongsu pkduongsu commented May 10, 2025

#542

Hi @hangfei,

This commit adds tests for:
mcp_tool.py
mcp_toolset.py
conversion_utils.py

Current test coverage:

Name                                                   Stmts   Miss  Cover
--------------------------------------------------------------------------
src\google\adk\tools\mcp_tool\conversion_utils.py         59      0   100%
src\google\adk\tools\mcp_tool\mcp_tool.py                 47     12    74%
src\google\adk\tools\mcp_tool\mcp_toolset.py              47      8    83%
--------------------------------------------------------------------------

Copy link

google-cla bot commented May 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ankursharmas ankursharmas requested a review from seanzhou1023 May 13, 2025 01:15
content=types.Content(role='user', parts=parts)
)
yield llm_response
user_text = message.server_content.input_transcription.text
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you run pyink --config pyproject.toml ? usually we don't need to reformat the codes as they are already formatted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, this file is unrelated to the PR. let's keep the PR clean

@@ -102,7 +102,7 @@ def get_session(
break
i -= 1
if i >= 0:
copied_session.events = copied_session.events[i + 1:]
copied_session.events = copied_session.events[i + 1 :]
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

@@ -137,5 +137,6 @@ async def get_tools(
mcp_session_manager=self._session_manager,
)
for tool in tools_response.tools
if self._is_selected(tool, readonly_context)
if self.tool_predicate is None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change is by mistake ?

@@ -93,6 +93,8 @@ def test_cli_create_cmd_invokes_run_cmd(


# cli run
import platform
Copy link
Collaborator

Choose a reason for hiding this comment

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

by mistake?

@@ -0,0 +1,106 @@
from typing import Any, Dict
Copy link
Collaborator

Choose a reason for hiding this comment

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

put this file in mcp_tool folder

@@ -0,0 +1,58 @@
import pytest
Copy link
Collaborator

Choose a reason for hiding this comment

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

put this file under mcp_tool folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants