Skip to content

feat(agentgateway): add mcp tools filtering#194

Open
jplbrun wants to merge 5 commits into
mainfrom
feat/add-mcp-tools-filtering
Open

feat(agentgateway): add mcp tools filtering#194
jplbrun wants to merge 5 commits into
mainfrom
feat/add-mcp-tools-filtering

Conversation

@jplbrun

@jplbrun jplbrun commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Disclaimer: Do not include SAP-internal or customer-specific information in this PR (e.g. internal system URLs, customer names, tenant IDs, or confidential configurations). This is a public repository.

Description

Adds filtering support to list_mcp_tools via a new MCPToolFilter dataclass. The implementation mirrors the existing AgentCardFilter / list_agent_cards pattern:

  • ord_ids is applied pre-fetch — non-matching fragments (LoB) or integration dependencies (customer) are skipped
    before any MCP server is queried, saving a network round-trip per excluded server.
  • names is applied post-fetch — tool names are only known after querying each MCP server.

Both the LoB and customer flows are supported.

Related Issue

Closes #177

Type of Change

Please check the relevant option:

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Dependency update

How to Test

  1. Run uv run pytest tests/agentgateway/unit/ -v

Checklist

Before submitting your PR, please review and check the following:

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Breaking Changes

None. The filter parameter defaults to None, so all existing call sites are unaffected.

Additional Notes

N/A

@jplbrun jplbrun marked this pull request as ready for review July 1, 2026 18:46
@jplbrun jplbrun requested a review from a team as a code owner July 1, 2026 18:46
credentials: CustomerCredentials,
system_token: str,
timeout: float,
names: list[str] | None = None,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can't we receive filter object directly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can, I'll include a commit changing the places that use name/ord_id to use filter instead. What do you think about me also changing get_agent_cards_lob in this PR so it follows the same patterns?

Comment thread src/sap_cloud_sdk/agentgateway/_lob.py
@jplbrun jplbrun requested a review from NicoleMGomes July 2, 2026 23:13
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.

Support MCP tools filtering

2 participants