Skip to content

⚡️ Add MCP protocol tests & unify error handling with ToolError#118

Merged
renardeinside merged 9 commits intomainfrom
test/add-tests-for-mcp
Feb 22, 2026
Merged

⚡️ Add MCP protocol tests & unify error handling with ToolError#118
renardeinside merged 9 commits intomainfrom
test/add-tests-for-mcp

Conversation

@renardeinside
Copy link
Copy Markdown
Collaborator

@renardeinside renardeinside commented Feb 22, 2026

Summary

  • Add comprehensive MCP protocol test suite (21 integration tests) using in-memory duplex channels
  • Add ToolError domain enum (InvalidInput, NotConfigured, OperationFailed, IndexNotReady) that separates protocol-level errors from tool-level errors
  • Fix: list_registry_components no longer returns protocol-level error when project has no [tool.apx.ui] config — now returns tool-level is_error=true like search_registry_components
  • Extract OpenAPI parsing into tools/openapi.rs module (project.rs reduced from ~970 to ~250 lines)
  • Add ValidatedAppPath newtype for compile-time safety on validated paths
  • Extract shared refresh_registries_if_stale method, eliminating ~14 lines of duplication
  • Add Debug derive to tool_response! macro and all response structs

Test plan

  • cargo build -p apx-mcp --release — clean compile
  • cargo clippy -p apx-mcp -- -D warnings — zero warnings
  • cargo test -p apx-mcp --lib — 32 unit tests pass
  • cargo test -p apx-mcp --test mcp_protocol — 21 integration tests pass
  • test_list_registry_components no longer hits Err(e) branch

🤖 Generated with Claude Code

renardeinside and others added 4 commits February 22, 2026 01:08
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Shared project fixture via OnceLock + `apx init`
- Server spawner using tokio::io::duplex
- Tests: smoke, initialize handshake, list_tools (15), list_resources,
  list_resource_templates, resource reads (info/project/unknown),
  routes tool with structured content regression check (e29c897)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tasks 6-10:
- check tool with structured content validation
- get_route_info with operation discovery
- Dev server lifecycle: start/stop/restart/logs
- Registry tools: list and search components
- Error handling: relative path, nonexistent path, unknown operation
- Cross-cutting structured content object validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@renardeinside renardeinside changed the title Add MCP protocol-level integration test suite Add MCP protocol tests & unify error handling with ToolError Feb 22, 2026
renardeinside and others added 5 commits February 22, 2026 13:10
…function

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sertions

- Replace subprocess apx/uv calls with apx_cli::init::run() + try_resolve_uv()
- Switch from --no-addons to --addons=ui for richer test project
- Remove defensive is_error bail-outs from routes/registry/structured content tests
- Assert real values instead of skipping on error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Make core OpenAPI spec types public with Serialize + Clone derives
- Add missing fields (title, description, example) for lossless round-trip
- Rewrite MCP openapi parsing to use typed structs instead of raw Value
- Update callers (project.rs, resources.rs) to use OpenApiSpec::from_json
- Import capitalize_first from core instead of duplicating

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	crates/mcp/src/tools/databricks.rs
@renardeinside renardeinside changed the title Add MCP protocol tests & unify error handling with ToolError ⚡️ Add MCP protocol tests & unify error handling with ToolError Feb 22, 2026
@renardeinside renardeinside merged commit 07bd60b into main Feb 22, 2026
3 checks passed
@renardeinside renardeinside deleted the test/add-tests-for-mcp branch February 22, 2026 14:34
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.

1 participant