Skip to content

feat(kagent-adk): expose MCP prompts and resources#1506

Open
jsonmp-k8 wants to merge 1 commit intokagent-dev:mainfrom
jsonmp-k8:feat/issue-890-mcp-capabilities
Open

feat(kagent-adk): expose MCP prompts and resources#1506
jsonmp-k8 wants to merge 1 commit intokagent-dev:mainfrom
jsonmp-k8:feat/issue-890-mcp-capabilities

Conversation

@jsonmp-k8
Copy link
Contributor

Summary

  • expose MCP resources from attached MCP servers to Python declarative agents via server-specific helper tools
  • expose MCP prompts from attached MCP servers and inject loaded prompt contents into the next model turn
  • add focused MCP capability tests for helper discovery and prompt/resource loading

Testing

  • uv run --group dev ruff check packages/kagent-adk/src/kagent/adk/_constants.py packages/kagent-adk/src/kagent/adk/_mcp_toolset.py packages/kagent-adk/src/kagent/adk/_mcp_capability_tools.py packages/kagent-adk/src/kagent/adk/types.py packages/kagent-adk/tests/unittests/test_mcp_capability_tools.py
  • uv run --group dev pytest packages/kagent-adk/tests/unittests/test_mcp_capability_tools.py packages/kagent-adk/tests/unittests/test_mcp_cleanup_resilience.py

Addresses #890 for the Python declarative runtime.

Copilot AI review requested due to automatic review settings March 14, 2026 04:58
Copy link
Contributor

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

Exposes MCP server prompts and resources to kagent-adk declarative Python agents by adding server-specific helper tools that can load prompt/resource contents into the next model turn.

Changes:

  • Extend KAgentMcpToolset to discover MCP prompt/resource capabilities and append corresponding helper tools.
  • Add capability loader tools to fetch MCP prompt/resource catalogs and inject selected contents into the LLM request.
  • Add focused unit tests covering helper discovery, unique helper naming per server, and prompt/resource loading behavior.

Reviewed changes

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

Show a summary per file
File Description
python/packages/kagent-adk/src/kagent/adk/_mcp_toolset.py Adds MCP prompt/resource APIs plus helper-tool creation and unique per-server helper naming.
python/packages/kagent-adk/src/kagent/adk/_mcp_capability_tools.py Implements helper tools that list available prompts/resources and inject selected content into the next model turn.
python/packages/kagent-adk/src/kagent/adk/_constants.py Centralizes the proxy host header constant.
python/packages/kagent-adk/src/kagent/adk/types.py Switches to importing PROXY_HOST_HEADER from _constants.py.
python/packages/kagent-adk/tests/unittests/test_mcp_capability_tools.py Adds unit tests for helper discovery and prompt/resource loading behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jsonmp-k8 jsonmp-k8 force-pushed the feat/issue-890-mcp-capabilities branch 3 times, most recently from 055e603 to 6b923f6 Compare March 14, 2026 05:46
Expose MCP server prompts and resources to kagent-adk declarative
Python agents via server-specific helper tools that inject loaded
prompt/resource contents into the next model turn.

- Extend KAgentMcpToolset to discover MCP prompt/resource capabilities
  and append corresponding helper tools during get_tools()
- Add capability loader tools that fetch MCP prompt/resource catalogs
  and inject selected contents into the LLM request
- Extract PROXY_HOST_HEADER to _constants.py for shared use
- Search backwards through contents for function responses so batched
  helper calls (resource + prompt in the same turn) work correctly
- Validate resource_names input type to handle bare strings from LLMs
- Harden _model_dump fallback for non-iterable objects
- Add focused unit tests covering helper discovery, unique naming,
  input coercion, combined helper calls, and prompt/resource loading

Addresses kagent-dev#890 for the Python declarative runtime.

Signed-off-by: Jaison Paul <paul.jaison@gmail.com>
@jsonmp-k8 jsonmp-k8 force-pushed the feat/issue-890-mcp-capabilities branch from 6b923f6 to 9db5f6c Compare March 18, 2026 04:23
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