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
Right now there's a content formatter that gets called when tools return. Anything other than a string basically.
The content formatter just dumps it to JSON
It would be nice if this was customizable. At the moment I have to wrap all my tool return calls in a formatter call to return something other than compressed json
For example, I'd like to return yaml from tool calls as that tends to be readable for humans and for machines or alternatively maybe I'd like to return prettified json
Perhaps a configurable formatting callable that defaults to dumping json?
The text was updated successfully, but these errors were encountered:
# We need to wrap the underlying call in a way that captures the response and then calls the formatter.
def format_response(func: Callable) -> Callable:
@functools.wraps(func)
async def wrapper(*args, **kwargs):
response = await func(*args, **kwargs)
return self.response_formatter(response)
return wrapper
# Register the tools with the MCP server.
mcp.add_tool(format_response(self.knowledge_base_client.create))
mcp.add_tool(format_response(self.knowledge_base_client.get))
I would really like to switch to using the mixin and the decorators and will try to figure out if I can do this probably by nesting the decorators
Right now there's a content formatter that gets called when tools return. Anything other than a string basically.
The content formatter just dumps it to JSON
It would be nice if this was customizable. At the moment I have to wrap all my tool return calls in a formatter call to return something other than compressed json
For example, I'd like to return yaml from tool calls as that tends to be readable for humans and for machines or alternatively maybe I'd like to return prettified json
Perhaps a configurable formatting callable that defaults to dumping json?
The text was updated successfully, but these errors were encountered: