spring-projects / spring-projects/spring-ai

Ability to react to exceptions thrown by @McpTool methods

Open
#4,488 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 7h
Merged PRs (30d)
6

Description

Expected Behavior

There is a way for me to react to @McpTool methods throwing exceptions, e.g. to log them.

Current Behavior

There is no way to react to exceptions, they are turned into an MCP error response (great!) and then discard, losing all stacktrace and cause information (not great!).

Context

I'm trying to diagnose errors in an MCP tool and not having the errors logged makes it quite painful.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the exception handling path for methods annotated with @McpTool and trace where exceptions become MCP error responses. Determine the project-supported way to expose or log the original exception, including its stack trace and cause, while preserving the existing error response behavior. Done means tool failures can be diagnosed without losing that information.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.