Skip to content

Conversation

@sixlive
Copy link
Contributor

@sixlive sixlive commented Jan 25, 2026

Description

Fixes #788

When a Laravel MCP tool returns Response::structured() or Response::make(), Prism throws an error because these methods return a ResponseFactory instead of a Response. The ResponseFactory class is neither iterable nor has a content() method, causing the code to fail.

This PR adds explicit handling for ResponseFactory in LaravelMcpTool::__invoke() by extracting the responses from the factory and converting them to strings.

Changes

  • Add ResponseFactory import and type annotation in LaravelMcpTool
  • Handle ResponseFactory responses by calling responses() and mapping content to strings
  • Add integration tests for all response types (single Response, ResponseFactory, Generator)
  • Bump laravel/mcp dependency to ^0.5.2

@kinsta
Copy link

kinsta bot commented Jan 25, 2026

Preview deployments for prism ⚡️

Status Branch preview Commit preview
✅ Ready Visit preview Visit preview

Commit: c016fcc49096679c491190d689b4036d697e7486

Deployment ID: 55d2cb6a-8895-43e0-bba7-2757a2970f0e

Static site name: prism-97nz9

@sixlive sixlive merged commit a855143 into main Jan 25, 2026
14 checks passed
@sixlive sixlive deleted the fix-laravel-mcp-usage branch January 25, 2026 16:15
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.

Laravel MCP tool responses causes validation error due to Response::structured() returning a ResponseFactory instead of Response

2 participants