spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

‌Metadata injection in tool calls

Open hongliangzhang07 opened this issue 7 months ago • 1 comments
trafficstars

Here's the translation of your technical proposal for Spring optimization:

When MCP invokes tools, can we add a metadata injection mechanism? The workflow would be:

User login → Authentication service returns tenantId → Store in MCP context Tools automatically carry tenantId during invocation Data queries perform tenant permission filtering using tenantId to prevent unauthorized access MCP should enforce these verifications before tool execution:

Client requests must carry tenantId metadata (Item 6) Server must validate the ownership relationship between user session and tenantId (Item 1) Tools can only access resources within the tenantId's authorized scope This proposal clearly outlines a multi-tenant security pattern using tenant isolation. You might want to reference Spring Security's existing tenant isolation capabilities and Spring Cloud Context's property propagation mechanisms when submitting this to Spring. Would you like me to help format this as an official Spring Enhancement Proposal (SEP) template?

hongliangzhang07 avatar Mar 29 '25 11:03 hongliangzhang07