-
Notifications
You must be signed in to change notification settings - Fork 499
feat(mcp): Add list_prompts, get_prompt methods #160
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
|
related: #151 |
|
Hi, Sorry but this has increased in priority because of internal needs. Thanks for marking this as editable by maintainers. I am taking over the PR to rebase, make some edits, and add tests. But @Ketansuhaas you will still have attribution on the PR, thanks for raising this. |
Thank you. I appreciate it. |
|
Noting that the recommendation in this PR is to expose the raw MCP SDK responses. This was not done for tools as the benefit of the MCPClient was to map the MCP tool to a Strands AgentTool. For Prompts and Resources, there is not native Strand concept. So we have two options one is to expose them with 1-1 methods as we have here. The other is to instruct users to use the underlying mcp session that is created. I agree with the initial proposal that interacting with MCPClient(strands) and the underling MCPClient.session seems strange. Additionally, allowing users to operate in both sync and async mode requires us to handle the wrapping ourselves as the underlying method is async. |
dismissing as I was the one who made many of these changes and should not self-review.
Co-authored-by: ketan-clairyon <ketan@clairyon.com> Co-authored-by: Dean Schmigelski <dbschmigelski+github@gmail.com>
Co-authored-by: ketan-clairyon <ketan@clairyon.com> Co-authored-by: Dean Schmigelski <dbschmigelski+github@gmail.com>
Description
This PR introduces two new methods to the
MCPClientclass:list_prompts_syncandget_prompt_sync.list_prompts_sync: This method synchronously retrieves a list of available prompts from the MCP server. It calls the asynchronouslist_promptsmethod on the underlying MCP session and returns theListPromptsResult.get_prompt_sync: This method synchronously retrieves a specific prompt by its ID from the MCP server, along with any specified arguments. It calls the asynchronousget_promptmethod on the MCP session and returns theGetPromptResult.These additions enhance the
MCPClient's capabilities to interact with MCP-based prompt services.How to use:
Listing available prompts:
Getting a specific prompt:
Related Issues
N/A
Documentation PR
N/A
Type of Change
Testing
hatch fmt --linterhatch fmt --formatterhatch test --allChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.