[Sprint 02] feat: Implement tool filtering module #12

Closed
opened 2026-02-03 21:01:00 +00:00 by lmiranda · 1 comment
Owner

Summary

Create tool_filter.py module to implement allowlist/denylist logic for tools imported from the marketplace.

Tasks

  • Create src/gitea_mcp_remote/tool_filter.py
  • Implement ToolFilter class
  • Implement filter_tools(tools: list[Tool]) -> list[Tool] function
  • Logic:
    • If ALLOWED_TOOLS is set, only return tools in allowlist
    • If DENIED_TOOLS is set, exclude tools in denylist
    • If both set, allowlist takes precedence
    • If neither set, return all tools
  • Add logging for filtered tools (debug level)
  • Handle tool name matching (case-insensitive, strip whitespace)

Acceptance Criteria

  • tool_filter.py exists with ToolFilter class
  • filter_tools() correctly implements allowlist/denylist logic
  • Edge cases handled (empty lists, invalid tool names, etc.)
  • Logging indicates which tools were filtered out
  • Unit testable (pure function, no side effects)

Dependencies

Blocked by: #11 (needs config to read ALLOWED_TOOLS/DENIED_TOOLS)

Context

This allows the wrapper to expose only a subset of marketplace tools, useful for security or deployment-specific restrictions.

References:

  • Corrective Rebuild specification
  • Step 5 of 14-step rebuild plan

Size: S (1-2 hours)

## Summary Create `tool_filter.py` module to implement allowlist/denylist logic for tools imported from the marketplace. ## Tasks - [ ] Create `src/gitea_mcp_remote/tool_filter.py` - [ ] Implement `ToolFilter` class - [ ] Implement `filter_tools(tools: list[Tool]) -> list[Tool]` function - [ ] Logic: - If `ALLOWED_TOOLS` is set, only return tools in allowlist - If `DENIED_TOOLS` is set, exclude tools in denylist - If both set, allowlist takes precedence - If neither set, return all tools - [ ] Add logging for filtered tools (debug level) - [ ] Handle tool name matching (case-insensitive, strip whitespace) ## Acceptance Criteria - `tool_filter.py` exists with `ToolFilter` class - `filter_tools()` correctly implements allowlist/denylist logic - Edge cases handled (empty lists, invalid tool names, etc.) - Logging indicates which tools were filtered out - Unit testable (pure function, no side effects) ## Dependencies **Blocked by:** #11 (needs config to read ALLOWED_TOOLS/DENIED_TOOLS) ## Context This allows the wrapper to expose only a subset of marketplace tools, useful for security or deployment-specific restrictions. **References:** - Corrective Rebuild specification - Step 5 of 14-step rebuild plan **Size:** S (1-2 hours)
lmiranda added this to the Sprint 02: Corrective Rebuild milestone 2026-02-03 21:01:00 +00:00
lmiranda added the Type/FeatureTech/PythonComponent/BackendPriority/HighSize/S labels 2026-02-03 21:01:00 +00:00
Author
Owner

⚠️ Blocked By: #11

⚠️ **Blocked By:** #11
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: personal-projects/gitea-mcp-remote#12