Skip to content

MCP polish: dedupe wrappers, fill test gaps #48

Description

@robinbowes

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions