Skip to content

Conversation

@zacksmash
Copy link
Contributor

A few new fluent methods have been added to the text() response type for meta() and structuredContent(). You may use the methods as a getter or setter for the corresponding property.

These properties are then read in the CallTool method and returned in the response, if they're available.

Example:

#[IsReadOnly()]
class WeatherTool extends Tool
{
    // ...

    /**
     * Handle the tool request.
     */
    public function handle(Request $request, WeatherData $weatherData): Response
    {
        $city = $request->get('city');

        return Response::text("Here is the current weather information you requested for {$city}.")
            ->meta(['route' => 'weather'])
            ->structuredContent($weatherData->handle());
    }

Ref #99

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.

1 participant