bedrock-kb-retrieval-mcp-server: expose metadata filtering in QueryKnowledgeBases tool
Describe the feature
The QueryKnowledgeBases tool currently only supports filtering by data_source_ids. The underlying Bedrock Retrieve API supports rich metadata filtering (equals, notEquals, greaterThan, lessThan, in, etc.) via the vectorSearchConfiguration.filter field, but this capability is not exposed through the MCP tool.
Use Case
Users who have indexed metadata attributes in their knowledge bases cannot leverage them for filtered retrieval. This feature would all users to apply rich metadata filters to their knowledge base queries, enabling more granular control over which documents are retrieved.
Proposed Solution
Add an optional metadata_filter parameter to QueryKnowledgeBases that accepts a raw Bedrock retrieval filter object and passes it through to the API. This is the most generic approach, it doesn't impose any schema opinions and lets users use any filter expression the Bedrock API supports.
When both data_source_ids and metadata_filter are provided, they are composed with andAll.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
Source: awslabs/mcp