Fixes issue #2431 where exclude_args fails when excluded parameters have
non-serializable types (e.g., ServerSession). The fix excludes parameters
from function annotations before Pydantic tries to serialize them.
Also adds deprecation notice that exclude_args will be deprecated in
FastMCP 2.14 in favor of dependency injection.
- Added validation to ensure all parameters listed in `exclude_args` exist in the function.
- Ensured parameters in `exclude_args` have default values to avoid runtime errors.
- Added test.
This introduces an `exclude_args` parameter to omit specified arguments
(such as `state`, `memory`, etc.).
It will exclude the mentioned args from the schema sent to the LLM and still allow them
to be passed when the tool is called.
This doesn't come with the MCP protocol but can be useful in many use cases.