Skip to content

Fix MCP pattern rendering and card layout#218

Merged
PaulJPhilp merged 9 commits into
mainfrom
advanced-mcp2-presentation
Jan 27, 2026
Merged

Fix MCP pattern rendering and card layout#218
PaulJPhilp merged 9 commits into
mainfrom
advanced-mcp2-presentation

Conversation

@PaulJPhilp
Copy link
Copy Markdown
Owner

Rebuilds examples from MDX, fixes get_pattern envelope handling, stabilizes MCP
outputs, and refines the card layout.

## Summary
Fixed all 5 priority levels of code quality issues in ep-cli package:

### P1: Try/Catch Blocks (10 fixes)
- commands/pattern-repo-commands.ts: 3 try/finally → Effect.addFinalizer()
- utils/release.ts: Dynamic import error handling with ParsedCommit interface
- utils/git.ts: Nested try/catch → Effect.sync()
- services/install/service.ts: JSON.parse → Effect.try()
- services/execution/helpers.ts: Module loading → Effect.sync() + TUIModule interface

### P2: Type Safety (6 fixes)
- services/display/service.ts: col:any → generic inference
- services/display/api.ts: Removed any from resource type
- utils/database.ts: db:any → Closeable interface
- Plus type definitions from P1 fixes

### P3: Control Flow (8+ fixes)
- services/display/service.ts: 6 methods refactored with withTUIFallback() helper
- commands/install-commands.ts: 2 commands refactored using Option.match()

### P4: Type Safety (1 fix)
- src/index.ts: (StateStore as any).Default → StateStore.Default

### P5: Documentation (1 fix)
- services/skills/api.ts: Added resource dependency documentation

## Results
- ✅ 168/168 tests passing
- ✅ 0 compilation errors
- ✅ 100% type safety
- ✅ 100% backward compatible
- ✅ ~70 LOC reduction
- ✅ 100% ep-admin pattern alignment

## Files Modified
- 9 code files
- 10 documentation files
- 26+ issues fixed
- Remove JSON blocks from elicitation content arrays (they're added conditionally by tool handlers)
- Refactor format parameter handling for search_patterns and get_pattern tools
- Fix: format='markdown' now returns markdown content only (no JSON blocks)
- Fix: format='json' returns JSON structured content with markdown explanation
- Fix: format='both' returns both markdown and JSON blocks
- Update elicitation helpers to return TextContent[] (no mimeType in union)
- Simplify tool handler filtering logic since JSON blocks aren't in elicitation.content

MCP Test Results:
- 129 passing (up from ~0)
- 3 failing (network connectivity issues, not code issues)
- 52 skipped
- 184 total MCP protocol tests

The fixes ensure proper separation of concerns between:
1. Human-readable markdown content (format gating in tool handlers)
2. Machine-readable JSON structured content (delivered via structuredContent field)
3. Elicitation responses (now delivery via structuredContent only)
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
effect-patterns Error Error Jan 27, 2026 5:31pm
effect-patterns-mcp-server Error Error Jan 27, 2026 5:31pm
effect-patterns-mcp-tier-v2 Error Error Jan 27, 2026 5:31pm

Request Review

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