You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to add custom parameter memberId to an MCP request.
MCP Service
@Service public class MemberTool { @Tool(description = "Query the user's order") public Map memberOrderInfo(Long memberId, Long orderNo){ //... } }
The output of "orderNo" is controlled by the LLM
"memberId" is customized by me
I need to query each person's own data through "memberId". Prevent "Broken Access Control"
I can't find the solution from the following methods
`org.springframework.ai.tool.ToolCallback
default String call(String toolInput, @nullable ToolContext tooContext) {
if (tooContext != null && !tooContext.getContext().isEmpty()) {
throw new UnsupportedOperationException("Tool context is not supported!");
}
return call(toolInput);
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How to add custom parameter memberId to an MCP request.
MCP Service
@Service public class MemberTool { @Tool(description = "Query the user's order") public Map memberOrderInfo(Long memberId, Long orderNo){ //... } }
The output of "orderNo" is controlled by the LLM
"memberId" is customized by me
I need to query each person's own data through "memberId". Prevent "Broken Access Control"
I can't find the solution from the following methods
`org.springframework.ai.tool.ToolCallback
default String call(String toolInput, @nullable ToolContext tooContext) {
if (tooContext != null && !tooContext.getContext().isEmpty()) {
throw new UnsupportedOperationException("Tool context is not supported!");
}
return call(toolInput);
}
org.springframework.ai.mcp.AsyncMcpToolCallback || SyncMcpToolCallback
@OverRide
public String call(String functionInput) {
Map<String, Object> arguments = ModelOptionsUtils.jsonToMap(functionInput);
return this.asyncMcpClient.callTool(new CallToolRequest(this.getToolDefinition().name(), arguments))
.map(response -> ModelOptionsUtils.toJsonString(response.content()))
.block();
}`
Beta Was this translation helpful? Give feedback.
All reactions