Skip to content

Filter get endpoints #65

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 2 commits into
base: main
Choose a base branch
from
Open

Filter get endpoints #65

wants to merge 2 commits into from

Conversation

itay-tadata
Copy link
Contributor

@itay-tadata itay-tadata commented Apr 15, 2025

Describe your changes

  • Added filter to only expose GET endpoints as MCP tools (best practice)
  • Works with the rest of the filtering options
  • Controlled by only_get_endpoints argument

Issue ticket number and link (if applicable)

Screenshots of the feature / bugfix

Checklist before requesting a review

  • Added relevant tests
  • Run ruff & mypy
  • All tests pass

Copy link

codecov bot commented Apr 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Comment on lines +333 to 334
operation_methods: Dict[str, str] = {}
operations_by_tag: Dict[str, List[str]] = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

naming consistency - if we have operations_by_tags already, call you dict operations_by_methods

@@ -333,38 +341,58 @@ def _filter_tools(self, tools: List[types.Tool], openapi_schema: Dict[str, Any])
operation_id = operation.get("operationId")
if not operation_id:
continue

# Store the HTTP method for each operation ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Too many redundant comments like these. I'm guessing that's Cursor noise. Please remove unless something really needs an explanation, otherwise it creates a resonance and LLMs will add more and more comments

@@ -50,6 +51,7 @@ def __init__(
exclude_operations: List of operation IDs to exclude from MCP tools. Cannot be used with include_operations.
include_tags: List of tags to include as MCP tools. Cannot be used with exclude_tags.
exclude_tags: List of tags to exclude from MCP tools. Cannot be used with include_tags.
only_get_endpoints: If True, only expose GET endpoints. This filter is applied after other filters.
Copy link
Contributor

Choose a reason for hiding this comment

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

why have this very specific niche param? maybe instead be consistent with the rest of the API, and have include_methods and exclude_methods?

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