Skip to content

Conversation

brandonspark
Copy link

@brandonspark brandonspark commented Aug 29, 2025

Motivation and Context

I am interested in being able to dynamically have a server offer only certain tools based on information received during its initialization. I could conditionally declare the tool, for instance:

if cond:
  @mcp.tool
  async def foo():
    ...

but I perceive this to be relatively gross. I would prefer to be able to remove a tool within the API.

How Has This Been Tested?

I can achieve comparable behavior by inserting an if before defining a function with the mcp.tool() decorator.

Breaking Changes

No.

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

Additional context

@brandonspark brandonspark requested a review from a team as a code owner August 29, 2025 18:32
@brandonspark brandonspark requested a review from Kludex August 29, 2025 18:32
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.

1 participant