Skip to content

Remove execution methods from Provider base class#2681

Merged
jlowin merged 1 commit intomainfrom
remove-provider-execution-methods
Dec 23, 2025
Merged

Remove execution methods from Provider base class#2681
jlowin merged 1 commit intomainfrom
remove-provider-execution-methods

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Dec 23, 2025

Removes call_tool, read_resource, read_resource_template, and render_prompt methods from the Provider base class. These methods were mistakenly included and don't belong in the provider interface—providers source components, they don't execute them.

Should have been removed entirely in #2663, not marked optional

@marvin-context-protocol marvin-context-protocol Bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. provider Related to the FastMCP Provider class server Related to FastMCP server implementation or server-side functionality. labels Dec 23, 2025
@jlowin jlowin removed the breaking change Breaks backward compatibility. Requires minor version bump. Critical for maintainer attention. label Dec 23, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 23, 2025

Walkthrough

This pull request removes four public execution helper methods from the Provider class: call_tool(), read_resource(), read_resource_template(), and render_prompt(). These methods previously delegated to corresponding tool, resource, template, and prompt components while performing type-specific result normalization. The removal also eliminates related imports including Any, ResourceContent, PromptResult, and ToolResult. The list and get methods for tools, resources, templates, and prompts remain unchanged. This change eliminates the default execution paths and implicit single-lookup behavior at the Provider level.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains what was removed and why, but lacks the required checklist items from the template (issue reference, testing confirmation, documentation updates, and self-review checkboxes). Add the required Contributors Checklist and Review Checklist sections with appropriate checkboxes completed to match the repository template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and accurately summarizes the main change: removing execution methods from the Provider base class.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-provider-execution-methods

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4177d83 and 4210daa.

📒 Files selected for processing (1)
  • src/fastmcp/server/providers/base.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Use Python ≥ 3.10 with full type annotations
Never use bare except - be specific with exception types

Files:

  • src/fastmcp/server/providers/base.py
🧠 Learnings (1)
📚 Learning: 2025-11-26T21:51:44.174Z
Learnt from: CR
Repo: jlowin/fastmcp PR: 0
File: .cursor/rules/core-mcp-objects.mdc:0-0
Timestamp: 2025-11-26T21:51:44.174Z
Learning: Review and update related Manager classes (ToolManager, ResourceManager, PromptManager) when modifying MCP object definitions

Applied to files:

  • src/fastmcp/server/providers/base.py
🧬 Code graph analysis (1)
src/fastmcp/server/providers/base.py (4)
src/fastmcp/prompts/prompt.py (1)
  • Prompt (118-322)
src/fastmcp/resources/resource.py (1)
  • Resource (137-331)
src/fastmcp/resources/template.py (1)
  • ResourceTemplate (97-298)
src/fastmcp/tools/tool.py (1)
  • Tool (126-369)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run tests: Python 3.10 on windows-latest
  • GitHub Check: Run tests with lowest-direct dependencies
  • GitHub Check: Run tests: Python 3.13 on ubuntu-latest
  • GitHub Check: Run tests: Python 3.10 on ubuntu-latest
🔇 Additional comments (3)
src/fastmcp/server/providers/base.py (3)

35-38: LGTM! Imports correctly streamlined.

The imports now include only the types needed for method signatures (Prompt, Resource, ResourceTemplate, Tool). The removal of Any, PromptResult, ResourceContent, and ToolResult is consistent with the deleted execution methods.


55-71: Good documentation of provider semantics.

Line 66 clearly documents that "Components execute themselves via run()/read()/render() - providers just source them". This effectively communicates the separation of concerns and helps future maintainers understand why execution methods don't belong here.


141-219: Verify no callers depend on the removed execution methods.

The list/get methods are correctly retained for sourcing components. Verification confirms that no code depends on the removed call_tool, read_resource, read_resource_template, or render_prompt methods on providers. All provider method calls in the server and Manager classes use only the retained interface: list_tools, get_tool, list_resources, get_resource, list_resource_templates, get_resource_template, list_prompts, and get_prompt.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jlowin jlowin merged commit 7dcccef into main Dec 23, 2025
14 checks passed
@jlowin jlowin deleted the remove-provider-execution-methods branch December 23, 2025 14:55
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. provider Related to the FastMCP Provider class server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant