Skip to content

Conversation

@jlowin
Copy link
Owner

@jlowin jlowin commented May 23, 2025

No description provided.

Copilot AI review requested due to automatic review settings May 23, 2025 22:54
@jlowin jlowin added the enhancement Improvement to existing functionality. For issues and smaller PR improvements. label May 23, 2025
@github-actions github-actions bot added the tests label May 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves FastMCP’s support for callable objects by enhancing tests for tools, prompts, and resources that use both synchronous and asynchronous callable classes. It also updates the conversion logic in the from_function methods (in tool, prompt, and template modules) to better handle callable classes and introduces configuration changes for rich tracebacks in logging.

  • Added thorough tests for callable objects and async callable objects.
  • Updated from_function logic across modules to handle callable classes.
  • Configured logging and settings to support rich tracebacks and added pytest-env configs.

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/tools/test_tool_manager.py New tests for callable and async callable objects in tool management.
tests/tools/test_tool.py Added tests for callable objects in tools.
tests/server/test_server_interactions.py Added tests for callable objects with context in tools, resources, and prompts.
tests/resources/test_resource_template.py Added test illustrating callable objects used as resource templates.
tests/prompts/test_prompt_manager.py & test_prompt.py Added tests for callable objects in prompt rendering.
src/fastmcp/utilities/logging.py Updated logging configuration to leverage the enable_rich_tracebacks flag.
src/fastmcp/tools/tool.py Updated from_function to support callable classes by extracting the call method.
src/fastmcp/settings.py Introduced enable_rich_tracebacks configuration alongside log_level.
src/fastmcp/resources/template.py Updated from_function to handle callable objects similarly to tools.
src/fastmcp/prompts/prompt.py Updated from_function to extract callable objects’ call method.
pyproject.toml Added pytest-env dependency and new environment variables for testing.

@jlowin jlowin merged commit 7c65a3c into main May 23, 2025
5 checks passed
@jlowin jlowin deleted the callable-object branch May 23, 2025 23:06
jordicore pushed a commit to jordicore/fastmcp that referenced this pull request Jul 2, 2025
Ensure that tools/templates/prompts are compatible with callable objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to existing functionality. For issues and smaller PR improvements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants