-
Notifications
You must be signed in to change notification settings - Fork 84
support mcp without list_prompts interface #447
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
base: main
Are you sure you want to change the base?
Conversation
|
@qingfei1994 Please add the following content to your PR description and select a checkbox: |
# Conflicts: # docs/content/docs/development/tool_use.md
|
Hi @wenjin272, could you help review this pull request? as we discussed in #434. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @qingfei1994. Sorry for the late reply. I see there are some ci failures related to mcp, so I thought this pr wasn't ready yet.
FAILED flink_agents/e2e_tests/e2e_tests_integration/e2e_tests_mcp/mcp_test.py::test_mcp - TypeError: 'NoneType' object is not iterable
I left some comments, and I think we need add a test case like e2e_tests_mcp/mcp_test.py which the difference is the mcp server doesn't support prompt.
| - All tools and prompts from the MCP server are automatically registered. | ||
| - Reference MCP prompts and tools by their names, like reference [local prompt]({{< ref "docs/development/prompts#using-prompts-in-agents" >}}) and [function tool]({{< ref "docs/development/tool_use#define-tool-as-static-method-in-agent-class" >}}) . No newline at end of file | ||
| - Reference MCP prompts and tools by their names, like reference [local prompt]({{< ref "docs/development/prompts/#using-prompts-in-agents" >}}) and [function tool]({{< ref "docs/development/tool_use/#define-tool-as-static-method-in-agent-class" >}}) . | ||
| - For MCP servers that do not support the list_prompts interface, the list_prompts method will return an empty list. In such cases, you need to define a LocalPrompt to call the tools. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think prompt is not required for calling MCP tools. The LLM understand the tools according to their metadata.
| return asyncio.run(self._list_prompts_async()) | ||
| try: | ||
| asyncio.run(self._list_prompts_async()) | ||
| except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return empty list for any exception may be too broad. Can we just return empty list for the exception that tells the mcp server doesn't support list prompt?
Linked issue: #412
For MCP server without list_prompts interface, we could return the empty list from list_prompts interface
For MCPTool, remove the exclude=True parameter from the mcpServer field to ensure it is serialized
Tests
Test connecting to a McpServer without list_prompts interface
API
Yes
Documentation
doc-neededdoc-not-neededdoc-included