Skip to content

[Server] Log expected tool failures at debug level - #433

Merged
chr-hertel merged 1 commit into
modelcontextprotocol:mainfrom
ousamabenyounes:fix/issue-157
Aug 21, 2026
Merged

[Server] Log expected tool failures at debug level#433
chr-hertel merged 1 commit into
modelcontextprotocol:mainfrom
ousamabenyounes:fix/issue-157

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Summary

  • log expected ToolCallException failures at debug severity instead of error severity
  • keep unexpected exceptions at error severity
  • preserve and verify the existing log message and context

Fixes #157

Test verification (RED → GREEN)

Before the production change, the focused regression test failed with:

Expected level: debug
Actual level: error
FAILURES! Tests: 1, Assertions: 1, Failures: 1.

After the change:

OK (26 tests, 125 assertions)

Full local CI replay:

PHP CS Fixer: 0 files can be fixed
PHPStan: No errors
PHPUnit: OK (1247 tests, 3396 assertions)
phpDocumentor: complete
php-diff-coverage: PASS 1/1 changed executable lines covered

Expected tool failures are part of normal tool execution, so log them at debug severity while preserving error logging for unexpected exceptions.

@chr-hertel chr-hertel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ousamabenyounes! 👍

@chr-hertel chr-hertel added the Server Issues & PRs related to the Server component label Aug 21, 2026
@chr-hertel
chr-hertel merged commit b1c7272 into modelcontextprotocol:main Aug 21, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Server Issues & PRs related to the Server component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Server] Lower log level on failing tool calls

2 participants