Skip to content

fastmcp: allow passing Tool directly to .add_tool #699

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
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vbarda
Copy link

@vbarda vbarda commented May 12, 2025

This change allows passing the FastMCP Tool instance directly via a new fastmcp_server.add_tool_instance method.

This is useful if someone needs to construct the Tool instance manually, without inspecting a function. For example, this can be used to convert LangChain tools to FastMCP-compatible tools and add those to an existing FastMCP server.

@dsp-ant dsp-ant requested review from dsp-ant and Kludex May 13, 2025 13:05
Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

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

I am okay with the general idea of allowing the registration of a Tool instance directly. However, I personally prefer using a separate function name over an overload, since the overload leads to add_tool having a very funky type signature. I personally would prefer if we add a add_tool_instance function instead. Would love to hear @Kludex or @ihrpr's opinion on the matter.

@vbarda
Copy link
Author

vbarda commented May 13, 2025

I am okay with the general idea of allowing the registration of a Tool instance directly. However, I personally prefer using a separate function name over an overload, since the overload leads to add_tool having a very funky type signature. I personally would prefer if we add a add_tool_instance function instead. Would love to hear @Kludex or @ihrpr's opinion on the matter.

sounds good - I will add a separate method!

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.

2 participants