Skip to content

Conversation

@TommeyChang
Copy link
Collaborator

@TommeyChang TommeyChang commented Mar 24, 2025

Description

In this commit, a model without built-in function calling ability can use a MCP tools from giving the tool_name and tool_args.
In this case, we can set agents to equip with the same type of tools reducing the search space.

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed:
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@TommeyChang TommeyChang changed the title feat: Add MCP to model without function calling. feat: enable MCP to models without function calling abiity Mar 25, 2025
@TommeyChang TommeyChang changed the title feat: enable MCP to models without function calling abiity feat: enable MCP to models without function calling ability Mar 25, 2025
@echo-yiyiyi echo-yiyiyi self-requested a review March 28, 2025 13:31
Copy link
Member

@echo-yiyiyi echo-yiyiyi left a comment

Choose a reason for hiding this comment

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

A very cool MCPAgent! Left some comments.

Also, I’d like to know—could you briefly explain what model_fc_available means and why we need these two modes?

Comment on lines 45 to 55
```json
{
"server_idx": idx,
"tool_name": "tool_name",
"tool_args": {
"arg1": value1,
"arg2": value2,
...
}
}
```
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the existing implementation, Deepseek-R1, gemmas and other models without function calling ability can not be used.
The model_fc_avaible is to set whether the large model has the function call ability.

I will change it into function_calling_available and try to use the modules for structured output and scraping.

model: Optional[BaseModelBackend] = None,
model_fc_available: bool = False,
) -> None:
r"""Initialize the MCP agent.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe also add the reference of MCP Agent design here if there is any?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

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

thanks @TommeyChang ! As @yiyiyi0817 mentioned it would be great if we can use structured output feature instead of using prompt-based method, added one more PR here: feel free to help with review~

await self._mcp_toolkit.disconnect()

def add_mcp_tools(self):
assert self._mcp_toolkit.is_connected(), "Server is not connected."
Copy link
Member

Choose a reason for hiding this comment

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

better not use assert in production code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK, I will fix it.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@TommeyChang TommeyChang enabled auto-merge (squash) March 31, 2025 06:39
@TommeyChang TommeyChang disabled auto-merge April 1, 2025 01:57
@MuggleJinx
Copy link
Collaborator

History messed up for review, moving to #2128.

@MuggleJinx MuggleJinx closed this Apr 7, 2025
auto-merge was automatically disabled April 7, 2025 13:56

Pull request was closed

@TommeyChang TommeyChang reopened this Apr 8, 2025
Wendong-Fan added a commit that referenced this pull request May 5, 2025
…ix for a clear git history) (#2128)

Co-authored-by: tommey <tommeychang@163.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Wendong <w3ndong.fan@gmail.com>
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com>
@Wendong-Fan
Copy link
Member

hey @TommeyChang , this feature has been merged in PR #2128, thanks so much for the contribution! Feel free to close this PR at your convenience

@Wendong-Fan
Copy link
Member

close as feature merged in another PR

@Wendong-Fan Wendong-Fan closed this May 9, 2025
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.

5 participants