---
enhancements:
  - |
    Support Multiple Tool String Outputs

    Added support for tools to define multiple string outputs using the ``outputs_to_string`` configuration.
    This allows users to specify how different parts of a tool's output should be converted to strings,
    enhancing flexibility in handling tool results.

    - Updated ``ToolInvoker`` to handle multiple output configurations.
    - Updated ``Tool`` to validate and store multiple output configurations.
    - Added tests to verify the functionality of multiple string outputs.

    **Example:** A search tool that returns ``{"documents": [...], "metadata": {...}, "debug_info": {...}}``
    can selectively generate string representations for only the outputs you care about:

    .. code-block:: python

        def format_documents(documents):
            return "\n".join(f"{i+1}. Document: {doc.content}" for i, doc in enumerate(documents))

        def format_summary(metadata):
            return f"Found {metadata['count']} results"

        tool = Tool(
            name="search",
            description="Search for documents",
            parameters={...},
            function=search_func,  # Returns {"documents": [Document(...)], "metadata": {"count": 5}, "debug_info": {...}}
            outputs_to_string={
                "formatted_docs": {"source": "documents", "handler": format_documents},
                "summary": {"source": "metadata", "handler": format_summary}
                # Note: "debug_info" is not included, so it won't be converted to a string
            }
        )

        # After invocation, the tool result includes:
        # {
        #     "formatted_docs": "1. Document Title\n   Content...\n2. ...",
        #     "summary": "Found 5 results"
        # }

    This enables tools to provide rich, varied context to language models or downstream components
    without requiring multiple tool calls, while keeping full control over which outputs are stringified.
