Skip to content

feat: add tutorial guided execution MCP tools (Phase 2)#12

Merged
jung-thomas merged 8 commits intomainfrom
feature/tutorial-guided-execution
Apr 21, 2026
Merged

feat: add tutorial guided execution MCP tools (Phase 2)#12
jung-thomas merged 8 commits intomainfrom
feature/tutorial-guided-execution

Conversation

@jung-thomas
Copy link
Copy Markdown
Contributor

Summary

  • Add 4 new MCP tools for AI-agent-driven tutorial walkthroughs: get_tutorial_step, update_tutorial_progress, get_tutorial_progress, list_active_tutorials
  • Add heuristic annotation engine (internal/tutorials/annotate.go) that extracts executable commands, file creates, and verification checks from tutorial step markdown
  • Add MergeCompletedSteps batch progress update function with deduplication, sorting, and completion detection
  • Wire DataDir into MCP server Deps and update server instructions for the 4 new tools (26 → 30 total)

Design

The MCP server is stateless — the AI agent drives the tutorial flow by calling tools sequentially. The annotation engine is intentionally conservative (false negatives preferred over false positives) and classifies fenced code blocks based on language tag and preceding text context. Progress is stored in tutorial-progress.json in the XDG data directory, shared between MCP tools and the existing TUI.

New Files

  • internal/tutorials/annotate.go — Annotation engine: AnnotateStep() pure function with block parsing/classification
  • internal/tutorials/annotate_test.go — 15 black-box tests
  • internal/mcpserver/tools_tutorial_exec.go — 4 MCP tool handlers + registration
  • internal/mcpserver/tools_tutorial_exec_test.go — 13 handler tests

Test Plan

  • go build ./... passes
  • go vet ./... passes
  • go test ./internal/tutorials/... passes (CI)
  • go test ./internal/mcpserver/... passes (CI)
  • MCP server starts and registers all 30 tools

Registers 4 new MCP tools (get_tutorial_step, update_tutorial_progress,
get_tutorial_progress, list_active_tutorials) in tools_tutorial_exec.go.
get_tutorial_step is fully implemented with loadOrFetchTutorial helper
(cache-hit → GitHub fetch fallback), StepAnnotations extraction, and
optional progress tracking. The other 3 handlers are stubs returning
"not implemented yet" for Tasks 6-7. Extends MCP server instructions
with guidance for the new tutorial execution tools.
Replaces the stub handler with a real implementation that merges
completed step indices into stored progress via MergeCompletedSteps,
validates slug and step ranges, and returns a progress snapshot.
Adds three unit tests covering the happy path, invalid slug, and
out-of-range step inputs.
Replaces the two remaining stub handlers with real implementations.
get_tutorial_progress returns a single-tutorial or all-tutorials
progress snapshot sorted by last access. list_active_tutorials
returns only incomplete tutorials (CompletedAt == nil), respects the
limit parameter, and is sorted by recency. Adds five unit tests
covering single/all/missing progress lookups and active-tutorial
filtering.
@jung-thomas jung-thomas merged commit deaf04e into main Apr 21, 2026
2 checks passed
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