MCP Usage Examples & Workflows
Common workflows and real-world examples for using LogicStamp Context MCP tools effectively.
Core Workflow
Always follow this workflow when working with a new project:
Start with refresh_snapshot
This scans the project and generates all context files. Creates context_main.json and per-folder context.json files.
logicstamp_refresh_snapshot({ projectPath: "/absolute/path/to/project" })Returns a snapshotId you'll use for subsequent calls.
Discover bundles with list_bundles
Lists all available bundles with their locations, component names, file paths, and token estimates.
logicstamp_list_bundles({ snapshotId: "snap_123" })Use folderPrefix to filter by directory if needed.
Read bundles with read_bundle
This is where the valuable data is. Pass the bundlePath from list_bundles output.
logicstamp_read_bundle({ snapshotId: "snap_123", bundlePath: "src/components/context.json" })Returns complete component contracts with dependency graphs.
Only then read raw files (if needed)
Use bundles first to understand structure. Drop to raw .ts/.tsx files only when bundles don't have enough detail.
Example 1: Understanding a Component
When you need to understand how a specific component works:
USER:
"Analyze the Button component in my project"
AI → MCP:
logicstamp_refresh_snapshot({ projectPath: "/absolute/path/to/project" })AI → MCP:
logicstamp_list_bundles({ snapshotId: "snap_123", folderPrefix: "src/components" })AI → MCP:
logicstamp_read_bundle({ snapshotId: "snap_123", bundlePath: "src/components/context.json", rootComponent: "Button" })AI:
Provides detailed analysis of Button's props, state, hooks, dependencies, and behavior patterns.
Example 2: Analyzing with Style Metadata
When you need to understand visual design and styling:
USER:
"Analyze my components with style information"
AI → MCP:
logicstamp_refresh_snapshot({ projectPath: "/absolute/path/to/project", includeStyle: true })Response includes includeStyle: true flag. Note: projectPath is required.
AI → MCP:
logicstamp_read_bundle({ snapshotId: "snap_123", bundlePath: "src/components/context.json" })AI:
Provides analysis including component structure (props, state, hooks), visual design (colors, spacing, typography), layout patterns (flex vs grid, responsive breakpoints), and animation usage.
Example 3: Safe Code Modification Workflow
Complete workflow for safely modifying code with verification:
1. USER:
"Add a --force flag to the clean command"
2-4. AI → MCP:
AI calls logicstamp_refresh_snapshot({ projectPath: "/absolute/path/to/project" }), logicstamp_list_bundles(), and logicstamp_read_bundle() to understand current implementation.
5. AI:
Understands current implementation: cleanCommand signature, existing flags and options, file structure.
6. AI → IDE:
Edits src/cli/commands/clean.ts - Adds --force flag handling.
7. AI → MCP:
logicstamp_compare_snapshot({ projectPath: "/absolute/path/to/project", forceRegenerate: true })Response shows: Modified files, added functions, semantic hash changes, token delta.
8. AI → USER:
Presents summary of changes and asks for approval: "Here's what changed: Modified: src/cli/commands/clean.ts, Added function: handleForceFlag, Semantic hash changed (expected), Token delta: +45. This matches the expected changes. Apply? (yes/no)"
Key Principles
- Prefer bundles over raw code - LogicStamp bundles are pre-parsed, structured summaries optimized for AI consumption
- Always start with refresh_snapshot - Don't assume context files exist
- Use list_bundles before read_bundle - Discover what's available first
- Check token estimates - Be aware of context size, especially for large projects
- Verify changes with compare_snapshot - Always verify modifications before approval
Ready to Learn More?
Explore best practices, profiles, style metadata, and comparison guides to get the most out of LogicStamp MCP.