-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Bug
When mcp_check_output returns redacted_data, the mcp_tool_interceptor in AxonFlowLangGraphAdapter returns the redacted string directly:
if output_check.redacted_data is not None:
return output_check.redacted_data # returns a raw strlangchain-mcp-adapters expects the interceptor to return an MCPToolCallResult (CallToolResult | ToolMessage | Command). When a plain str is returned instead, _convert_call_tool_result in langchain_mcp_adapters/tools.py attempts to access .content on the string, raising:
AttributeError: 'str' object has no attribute 'content'
Steps to Reproduce
- Run the
langgraph-samplewith a query that triggers PII redaction on an MCP tool output (e.g."tell me everything about alice and bob"— Alice's record contains an SSN). - The
getUserInfoMCP tool returns"SSN: 123-54-8967. Favorite color: blue.". mcp_check_outputredacts the SSN and setsredacted_data.- The interceptor returns the redacted
str, whichlangchain-mcp-adapterscannot process.
Expected Behavior
The interceptor should wrap the redacted string in a CallToolResult so the return type is always a valid MCPToolCallResult.
Fix
Wrap redacted_data in a CallToolResult:
from mcp.types import CallToolResult, TextContent
if output_check.redacted_data is not None:
return CallToolResult(content=[TextContent(type="text", text=output_check.redacted_data)])Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels