Skip to content

Create specific ToolNotFoundError for easier handling than ToolError in multi-tenant environments#2423

Open
DevonFulcher wants to merge 1 commit intomodelcontextprotocol:mainfrom
dbt-labs:devon/Create_specific_ToolNotFoundError_for_easier_handling_in_multi-tenant_environments
Open

Create specific ToolNotFoundError for easier handling than ToolError in multi-tenant environments#2423
DevonFulcher wants to merge 1 commit intomodelcontextprotocol:mainfrom
dbt-labs:devon/Create_specific_ToolNotFoundError_for_easier_handling_in_multi-tenant_environments

Conversation

@DevonFulcher
Copy link
Copy Markdown

Summary

Create a new error type ToolNotFoundError that is a more specific version of the generic ToolError.

closes #2422

Motivation and Context

We are running a remote MCP server and we are seeing errors like:

mcp.server.fastmcp.exceptions.ToolError: Unknown tool: <unknown-tool-name>

I'm unsure why our users are trying to call our remote MCP server with the name of a tool that we don't manage. Regardless, we would like to handle these errors separately from a generic ToolError. For instance:

  • ToolNotFoundError: user error that shouldn't alert us.
  • ToolError: an error that could indicate an actual issue with our system that we should alert on and fix.

How Has This Been Tested?

I added unit tests and successfully ran all tests locally.

Breaking Changes

There are no breaking changes in this PR. SDK users can still catch these as ToolError as they have done before.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

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.

Specific ToolNotFoundError for easier handling than ToolError in multi-tenant environments

1 participant