Goal
Small tech-debt cleanup in the MCP layer that built up while shipping
Phase 4 quickly.
Sub-tasks
- Collapse
_wrap / _wrap_mutation triplication. The same
helper pair lives in mcp/tools/lifecycle.py,
mcp/tools/fields.py, and mcp/tools/relations.py.
Extract to a single shared module under mcp/tools/_wrap.py (or
mcp/_helpers.py).
- Add a test for
_require_mcp_sdk error path. Currently no
coverage for the case where the mcp package is missing —
important because that path is what users hit when they install
without the [mcp] extra.
- Lift coverage in
tests/mcp/test_tools_relations.py to
match its sibling test files. Relations cover tags / contacts /
links — three sub-surfaces, currently thinner test cases than
fields/lifecycle.
Design considerations
- Keep the wrapper signature compatible — call sites won't change.
- The missing-SDK test should patch
importlib.import_module (or
the sentinel that _require_mcp_sdk checks), not actually
uninstall the package.
Out of scope
- Restructuring the tool registration mechanism.
- Public API changes.
Cost estimate
Half-day total.
Goal
Small tech-debt cleanup in the MCP layer that built up while shipping
Phase 4 quickly.
Sub-tasks
_wrap/_wrap_mutationtriplication. The samehelper pair lives in
mcp/tools/lifecycle.py,mcp/tools/fields.py, andmcp/tools/relations.py.Extract to a single shared module under
mcp/tools/_wrap.py(ormcp/_helpers.py)._require_mcp_sdkerror path. Currently nocoverage for the case where the
mcppackage is missing —important because that path is what users hit when they install
without the
[mcp]extra.tests/mcp/test_tools_relations.pytomatch its sibling test files. Relations cover tags / contacts /
links — three sub-surfaces, currently thinner test cases than
fields/lifecycle.
Design considerations
importlib.import_module(orthe sentinel that
_require_mcp_sdkchecks), not actuallyuninstall the package.
Out of scope
Cost estimate
Half-day total.