Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[0.x] Adding events to tool calls #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Katalam wants to merge 1 commit into laravel:main
base: main
Choose a base branch
Loading
from Katalam:feat/add-events

Conversation

Copy link

@Katalam Katalam commented Aug 20, 2025

To add a better event handling of tool calls I've added 3 new events

  • Laravel\Mcp\Server\Events\ToolCallFailed
  • Laravel\Mcp\Server\Events\ToolCallFinished
  • Laravel\Mcp\Server\Events\ToolCallStarting

Inside the CallTool Method they will be dispatched through the normal framework dispatcher.
I added 2 new test cases to catch the ToolCallFinished and ToolCallFailed events.

I personally can now listen to these events instead of having a wrapper function for each tool.

A new doc block is possible

The mcp server dispatches three events when running tools: Laravel\Mcp\Server\Events\ToolCallStarting, Laravel\Mcp\Server\Events\ToolCallFinished, and Laravel\Mcp\Server\Events\ToolCallFailed. The ToolCallStarting event is dispatched immediately when the tool call starts running. Next, the ToolCallFinished event is dispatched immediately after a tool call finished executing. If needed, the ToolCallFailed event is dispatched once a command fails validating inside the execution.

danielgnh and kauffinger reacted with thumbs up emoji
@Katalam Katalam changed the title (削除) Adding events to tool calls (削除ここまで) (追記) [0.x] Adding events to tool calls (追記ここまで) Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /