Skip to content

Support FastMCP 3.x while maintaining 2.x compatibility#852

Merged
mitchh456 merged 1 commit into
fix/rq-job-id-propertyfrom
fix/fastmcp-3-compatibility
Apr 6, 2026
Merged

Support FastMCP 3.x while maintaining 2.x compatibility#852
mitchh456 merged 1 commit into
fix/rq-job-id-propertyfrom
fix/fastmcp-3-compatibility

Conversation

@mitchh456
Copy link
Copy Markdown
Contributor

Summary

  • Update FastMCP instrumentation and tests for FastMCP 3.0 compatibility
  • FastMCP 3.0 replaced private _call_tool_mcp()/_list_tools_mcp() with public call_tool()/list_tools()
  • FastMCP 3.0 changed get_tool() to return None instead of raising
  • Tests use version-detecting compat helpers so they work with both 2.x and 3.x
  • No version pin needed — works with fastmcp>=2.9.0

Changes

  • src/scout_apm/fastmcp.py: Handle get_tool() returning None in 3.x
  • tests/integration/test_fastmcp.py: Add _call_tool()/_list_tools() compat helpers

Test plan

  • FastMCP tests pass with fastmcp 2.x (current)
  • FastMCP tests pass with fastmcp 3.x (latest)

🤖 Generated with Claude Code

FastMCP 3.0 replaced private _call_tool_mcp()/_list_tools_mcp() with
public call_tool()/list_tools() methods, and changed get_tool() to
return None instead of raising when a tool is not found.

- Update instrumentation to handle get_tool() returning None
- Update tests with compat helpers that use the correct API based on
  the installed fastmcp version
- Remove the fastmcp<3 version pin from tox.ini (no longer needed)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mitchh456 mitchh456 force-pushed the fix/fastmcp-3-compatibility branch from b490695 to ec800d2 Compare April 1, 2026 15:34
@mitchh456 mitchh456 changed the base branch from fix/rq-job-id-property to master April 1, 2026 21:25
@mitchh456 mitchh456 changed the base branch from master to fix/rq-job-id-property April 1, 2026 21:25
@mitchh456 mitchh456 merged commit 5f43a68 into fix/rq-job-id-property Apr 6, 2026
12 checks passed
@mitchh456 mitchh456 deleted the fix/fastmcp-3-compatibility branch April 6, 2026 15:53
mitchh456 added a commit that referenced this pull request Apr 6, 2026
* Use Job.id property instead of removed get_id() method

rq v2.7 refactored Job.id from `id = property(get_id, set_id)` to a
`@property` decorator, removing get_id() as a callable method.
Job.id has been available since rq v0.5.0 so this is backwards compatible.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Support FastMCP 3.x while maintaining 2.x backwards compatibility (#852)

FastMCP 3.0 replaced private _call_tool_mcp()/_list_tools_mcp() with
public call_tool()/list_tools() methods, and changed get_tool() to
return None instead of raising when a tool is not found.

- Update instrumentation to handle get_tool() returning None
- Update tests with compat helpers that use the correct API based on
  the installed fastmcp version
- Remove the fastmcp<3 version pin from tox.ini (no longer needed)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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