Best Practices

MCP Best Practices

Learn how to use LogicStamp Context MCP tools effectively and efficiently.

Core Workflow Practices

✓ Always start with refresh_snapshot

Don't assume context files exist. Always call logicstamp_refresh_snapshot first to generate fresh context files and get a snapshotId.

✓ Read context_main.json first

Understand project structure before diving into bundles. Use logicstamp_read_bundle with bundlePath: "context_main.json" to get the overview.

✓ Prefer bundles over raw code

Use bundles for structure, raw code for implementation details. LogicStamp bundles are pre-parsed, structured summaries optimized for AI consumption.

✓ Use list_bundles before read_bundle

Discover what's available first. Use folderPrefix to filter bundles by directory path.

Token Optimization

Check token estimates

Be aware of context size, especially for large projects. Token estimates are provided in snapshot summaries and bundle listings.

Use logicstamp_compare_modes to see exact token costs for different modes before committing.

Use appropriate mode

Choose the right code inclusion mode for your use case:

  • header (default) - Recommended for most AI interactions (~70% savings)
  • none - Maximum compression for CI/CD (~79% savings)
  • full - Only when you need complete source code

Style metadata adds overhead

Only use includeStyle: true when you need visual/design information. Style metadata adds ~15-20% token overhead.

Snapshot Management

Save snapshotId

After calling logicstamp_refresh_snapshot, save the returned snapshotId. You'll need it for subsequent tool calls.

Snapshots expire after TTL

Snapshots are stored in memory and expire after a TTL period. If you get "Snapshot not found" errors, call logicstamp_refresh_snapshot again to create a new snapshot.

Refresh after code changes

If you've made code changes, call logicstamp_refresh_snapshot again to regenerate context files, or use forceRegenerate: true in logicstamp_compare_snapshot.

Change Verification

Always verify changes

After making edits, use logicstamp_compare_snapshot to verify what changed:

logicstamp_compare_snapshot({ forceRegenerate: true })

Review change details

Check the details field in comparison results to understand what changed: props added/removed, functions changed, imports modified, etc.

Check token deltas

Monitor token count changes. Positive deltas mean more tokens (added code/components), negative means fewer (removed code/components).

Understanding Missing Dependencies

Bundles include a meta.missing[] field with unresolved dependencies:

Expected (safe to ignore):

  • "external package" - Third-party npm modules (React, lodash, etc.)

Actionable:

  • "file not found" - Broken imports, need fixing
  • "outside scan path" - Consider expanding scan directory
  • "max depth exceeded" - Increase depth if needed
  • "circular dependency" - Review import structure

Token Efficiency Notes

LogicStamp bundles are intentionally compressed. Missing micro-details is normal and expected.

  • header mode: ~70% savings vs raw source
  • none mode: ~79% savings vs full context
  • Style metadata adds ~15-20% overhead

Use logicstamp_compare_modes to see exact token costs for your project.

Explore More Guides

Learn about profiles, style metadata, comparison workflows, and troubleshooting.