Sync upstream updates: MCP skills and AI tool input streaming
Merged
BI
21m ago+3939+3939+0123456789012345678901234567890123456789-193-193-012345678901234567890123456789
Laravel Updates
- laravel/mcp PR 410 — Add support for the MCP Skills extension (
io.modelcontextprotocol/skills), includingSkill,DirectorySkill,SkillResource,skills/listandskills/getmethods,resources/listandresources/readintegration,make:mcp-skillgenerator and stubs, dependencies insrc/mcp/composer.json, and skills documentation. - laravel/ai PR 1250 — Flag failed tool results with
is_error: truewhen mapping messages for Anthropic. - laravel/ai PR 1249 — Port Anthropic prompt-cache test verifying the tools cache breakpoint skips deferred tools and consolidate Hypervel's prior deferred-tool test case under it.
- laravel/ai PR 1251 — Port Anthropic native structured-output tool-choice tests through
ToolChoiceAgentwhile retaining middleware and thinking coverage. - laravel/ai PR 1245 — Capture and replay reasoning fields across OpenAI-compatible tool loops and delegate DeepSeek message mapping to the shared chat-completion mapper while keeping DeepSeek's empty
reasoning_contentfallback. - laravel/ai PR 1241 — Port Groq and OpenAI AG-UI tool-result replay mapping tests verifying paired provider call IDs.
- laravel/ai PR 1239 — Stream tool input as it arrives via
ToolInputStart,ToolInputDelta, andToolInputErrorevents across all text gateways, Anthropic eager input streaming,TextGenerationLoop,AgentUserInteractionProtocol,VercelDataProtocol, and AI SDK docs. - laravel/ai PR 1233 — Honor the
Strictattribute on Mistral and OpenRouter tools throughMapsChatCompletionTools::supportsStrictTools()and update the AI SDK strict-tools documentation. - laravel/ai PR 1261 — Update default, cheapest, and smartest text models in
config/ai.phpand the Anthropic, Azure OpenAI, Bedrock, Gemini, OpenAI, and OpenRouter providers.
Additional Hypervel changes
- Clone resolved
Skillinstances inServerContext::resolveSkills()so auto-singletoned skill classes do not shareonce()frontmatter caches across calls in the same coroutine, and registerSkill::flushState()inAfterEachTestSubscriberfor static attribute metadata cleanup. - Replace protected
TextGenerationLoop::unfinishedToolInputs()with in-placetrackUnfinishedToolInput(array &$toolInputs, StreamEvent $event): voidto avoid quadratic copy-on-write string copying across streamed tool-input deltas, and document the protected-helper difference insrc/ai/README.md. - Extend
BroadcastBatcherto batch adjacentToolInputDeltaevents by invocation and tool ID, keepingToolCallordering intact, and updateconfig/ai.php,src/ai/README.md,src/docs/ai-sdk.md, andsrc/docs/porting-from-laravel.md. - Keep Bedrock's synthetic
structured_outputtool internal during streaming sogenerateStreamStep()with a schema does not emitToolInputStartorToolInputDeltaevents for it. - Keep
resultIdnull inAgentUserInteraction::toolResultFrom()and document why client- or hydrator-assigned AG-UI message IDs are not copied into providercall_idfields when mappers already pair calls and results ontoolCallId. - Keep Anthropic's synthetic
output_structured_datatool internal during streaming without enablingeager_input_streamingon it, preserve expliciteager_input_streamingvalues in Anthropic provider options with??= true, drop malformed Anthropic streamed tool inputs regardless of stop reason (preserving signedthinkingreplay when another valid tool call remains), and strip length-cut-off tool calls and raw replay blocks on cut-off steps across Anthropic, Bedrock, Cohere, Gemini, and OpenAI. - Cast unfinished tool-input keys to
stringinTextGenerationLoop::unfinishedToolInputErrors()for numeric tool IDs, and populatereplayBlocksProviderinTextGenerationLoop::buildAssistantMessage()so in-memory messages strip foreign replay blocks across providers. - Filter unsupported
temperatureandtopPsampling parameters on Bedrock Claude 4.7+ and 5.x models (and droptopPwhentemperatureis set on compatible Claude models) inBedrockTextGateway::buildConverseParameters(). - Send
x-anthropic-beta: structured-outputs-2025-11-13by default inCreatesOpenRouterClient::client()(overridable via configuredheaders) so OpenRouter enforcesstrict: trueon Claude tool definitions. - Preserve custom
skills/listandskills/gethandlers registered inboot()via??=inServer::detectSkillsCapability(), and reject empty normalized skill slugs inMakeSkillCommand::handle().
Summary by cubic
Syncs upstream Laravel AI and MCP updates. MCP servers now support the Skills extension (io.modelcontextprotocol/skills), and AI streams publish tool input fragments as they arrive instead of only when a tool's arguments complete.
New Features
- Adds
Skill,DirectorySkill, andSkillResource, plusskills/listandskills/getmethods, resource integration, and amake:mcp-skillgenerator. - Adds
ToolInputStart,ToolInputDelta, andToolInputErrorstream events across all text gateways, Anthropiceager_input_streaming, and AG-UI/Vercel Data mappings.
Behavior Changes
- Failed Anthropic tool results are flagged
is_error: true, and reasoning fields replay under the provider's original field in OpenAI-compatible tool loops. - Malformed Anthropic tool inputs are dropped regardless of stop reason, so the stream reports
ToolInputErrorinstead of invoking the tool; remaining valid tool calls keep their reasoning replay. - DeepSeek now delegates message mapping to the shared OpenAI-compatible mapper, keeping its empty
reasoning_contentfallback. - The
Strictattribute is honored on Mistral and OpenRouter tools; default provider model names are updated. - Skill instances are cloned per request so auto-singletoned classes don't share
once()frontmatter caches, and unfinished tool inputs are tracked in place to avoid quadratic string copying across streamed deltas.
[!NOTE]
Add MCP skills extension and AI tool-input streaming across providers
- Adds MCP skills: a
Skill base class, ServerContext resolution, skills/list and skills/get JSON-RPC methods, and a make:mcp-skill generator command in MakeSkillCommand.php. Registered skills appear as resources with their SKILL.md and bundled files.
- Adds tool-input streaming for most providers (Anthropic, OpenAI, OpenAI-compatible, Gemini, Bedrock, Cohere, xAI, DeepSeek). A shared StreamsToolInput.php concern emits start and delta events as tool arguments arrive, before the completed tool call.
- TextGenerationLoop.php emits a
ToolInputError when a streamed tool input never completes, and tool input cut off by the length limit is dropped from tool calls and replay blocks.
- AG-UI and Vercel Data protocol mappers, plus BroadcastBatcher.php, now handle tool-input events; adjacent deltas from the same tool are batched.
- Also fixes Anthropic failed tool results to be marked
is_error, enables strict tools for Mistral and OpenRouter, drops unsupported Bedrock sampling parameters, and changes the default Azure OpenAI deployment to gpt-6.2-sol.
- Behavioral Change: Anthropic streamed requests enable eager input streaming for typed tools by default (BuildsTextRequests.php), and requests omit
topP for supported Claude models when temperature is set (BedrockTextGateway.php).
Macroscope summarized 13c33f7.
Summary by CodeRabbit
- New Features
- MCP servers can now expose reusable Skills, with discovery, retrieval, resource access, and a command to generate skill files.
- AI providers stream tool inputs as they arrive, with incomplete inputs reported as errors rather than executed.
- Strict tool definitions are supported by Mistral and OpenRouter; failed Anthropic tool results are identified as errors.
- Improvements
- Broadcasts batch adjacent tool-input deltas alongside text and reasoning.
- Updated default AI models across several providers; configured model overrides remain in effect.
- Documentation
- Added guidance for MCP Skills and streamed tool inputs.