Skip to content

Conversation

@harshpreet931
Copy link
Collaborator

This pull request enhances the way responses from the MCP provider are processed and returned, focusing on extracting and presenting cleaner, more usable data from complex response structures. The changes introduce a helper method for extracting JSON or text content, and improve the metadata attached to tool results for easier debugging and traceability.

Key improvements to response handling and metadata:

Response extraction and formatting:

  • Added a new _extract_clean_data method to jaf/providers/mcp.py for extracting and cleaning JSON or text data from complex, nested MCP responses, handling cases with TextContent wrappers and multiple encoding layers.
  • Updated the execute method to use the new extraction helper, ensuring that the returned data field contains clean, user-friendly content instead of raw or doubly-encoded data.

Metadata and diagnostics:

  • Enhanced the ToolMetadata object in the execute method to include a concise summary of the MCP response (meta info, content length, presence of structured content, and error status), improving the ability to trace and debug tool executions.

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.

2 participants