STEP 3 of the LogicStamp MCP workflow. Call this to get the actual useful data - component contracts, dependencies, and style metadata.
logicstamp_read_bundle reads the full component bundle from a snapshot. This is where the actual useful data is. Call this after logicstamp_list_bundles to get detailed component information.
The command returns a complete UIFContract with:
- Props - Types, optional flags, descriptions
- State variables -
useStatehooks and their types - Hooks used - All React hooks in the component
- Dependency graph - What components/functions this imports
- Exports - Default and named exports
- Source code - Optional (based on
modefromrefresh_snapshot) - Style metadata - If
includeStyle: truewas used inrefresh_snapshot
Important: This is the ONLY way to see component contracts, dependencies, and style information. The refresh_snapshot summary does NOT include this data.
- After listing bundles - Get detailed information about specific components
- Component analysis - Understand component props, state, and dependencies
- Dependency exploration - See what a component imports and uses
- Style analysis - Access style metadata when
includeStyle: truewas used - Code generation - Get component contracts for AI-assisted code generation
- Type:
string - Description: The snapshot ID returned from
logicstamp_refresh_snapshot. This identifies which snapshot to read from.
-
Type:
string -
Description: Relative path to
context.jsonfile orcontext_main.json. Get this value from thebundlePathfield inlogicstamp_list_bundlesoutput.Examples:
"context_main.json"- Read the main index file (returns LogicStampIndex)"src/components/context.json"- Read a bundle file (returns LogicStampBundle)"src/pages/context.json"- Read a bundle file"src/utils/context.json"- Read a bundle file
-
Type:
string -
Description: Specific component name to filter within the bundle file. Use the
rootComponentvalue fromlist_bundlesoutput if you want a specific component.If omitted, returns the first bundle in the file.
Examples:
"Button"- Get the Button component bundle"Card"- Get the Card component bundle"HomePage"- Get the HomePage component bundle
Returns a ReadBundleOutput object with:
- Type:
string - Description: The snapshot ID that was queried
- Type:
string - Description: The bundle path that was read
- Type:
string(optional) - Description: The root component name if specified (only used for bundle files, not index files)
- Type:
LogicStampBundle - Description: The complete bundle object (present when reading bundle files, not when reading
context_main.json). Contains:
- Type:
LogicStampIndex - Description: The complete index object (present when reading
context_main.json, not when reading bundle files). Contains:type:"LogicStampIndex"schemaVersion: Schema version stringsummary: Summary statistics (totalComponents, totalBundles, totalFolders, totalTokenEstimate, tokenEstimates, missingDependencies)folders: Array of folder metadata with paths, bundle counts, component lists, and token estimatesprojectRoot: Relative project root pathprojectRootAbs: Absolute project root path
Note: The output will contain either bundle (for bundle files) or index (for context_main.json), but not both.
{
$schema?: string;
position: string; // e.g., "1/5"
type: 'LogicStampBundle';
schemaVersion: string;
entryId: string; // Normalized component path
depth: number; // Dependency depth
createdAt: string; // ISO timestamp
bundleHash: string; // Bundle hash identifier
graph: {
nodes: GraphNode[]; // Component nodes with contracts
edges: GraphEdge[]; // Dependency relationships
};
meta: {
missing: string[]; // Missing dependencies
source: string; // Source identifier
};
}Each node contains a contract field with the UIFContract:
{
type: 'UIFContract';
schemaVersion: string;
kind: 'react:component' | 'ts:module' | 'node:cli' | 'node:api';
entryId: string;
entryPathAbs: string; // Absolute file path
entryPathRel: string; // Relative POSIX path
description: string; // Natural language summary
version: {
variables?: string[]; // Variable declarations
hooks?: string[]; // React hooks used
components?: string[]; // Components rendered
functions?: string[]; // Function declarations
imports?: string[]; // Import statements
};
logicSignature: {
props: Record<string, PropType>; // Props with types
emits: Record<string, EventType>; // Event handlers
state?: Record<string, string>; // useState shapes
};
exports?: {
default?: string; // Default export name
named?: string[]; // Named exports
};
prediction?: string[]; // Behavioral hints
nextjs?: {
directive?: 'client' | 'server';
isInAppDir?: boolean;
};
semanticHash: string; // Content-based hash
fileHash: string; // File-based hash
style?: { // Style metadata (if includeStyle: true)
styleSources: {
tailwind?: {
categories: {
layout: string[];
spacing: string[];
colors: string[];
typography: string[];
borders: string[];
effects: string[];
};
breakpoints: string[];
classCount: number;
};
scssModule?: string;
scssDetails?: {
selectors: string[];
properties: string[];
features: {
variables: boolean;
nesting: boolean;
};
};
motion?: {
components: string[];
variants: string[];
features: {
gestures: boolean;
viewportAnimations: boolean;
};
};
};
layout: {
type: "flex" | "grid";
cols?: string;
hasHeroPattern?: boolean;
hasFeatureCards?: boolean;
};
visual: {
colors: string[];
spacing: string[];
radius?: string;
typography: string[];
};
animation?: {
library: "framer-motion" | "css";
type: string;
trigger: string;
};
};
}{
from: string; // Source component entryId
to: string; // Target component entryId
type: 'dependency' | 'uses' | 'usedBy';
}{
"name": "logicstamp_read_bundle",
"arguments": {
"snapshotId": "snap_1764033034172_0",
"bundlePath": "context_main.json"
}
}This returns the complete LogicStampIndex with project overview, summary statistics, and folder structure.
{
"name": "logicstamp_read_bundle",
"arguments": {
"snapshotId": "snap_1764033034172_0",
"bundlePath": "src/components/context.json"
}
}This returns the first bundle in src/components/context.json.
{
"name": "logicstamp_read_bundle",
"arguments": {
"snapshotId": "snap_1764033034172_0",
"bundlePath": "src/components/context.json",
"rootComponent": "Button"
}
}This returns the Button component bundle specifically.
{
"snapshotId": "snap_1764033034172_0",
"bundlePath": "context_main.json",
"index": {
"type": "LogicStampIndex",
"schemaVersion": "0.2",
"projectRoot": ".",
"summary": {
"totalComponents": 14,
"totalBundles": 14,
"totalFolders": 8,
"totalTokenEstimate": 5869
},
"folders": [
{
"path": "src/components",
"contextFile": "src/components/context.json",
"bundles": 1,
"components": ["Button"],
"tokenEstimate": 353
}
]
}
}{
"snapshotId": "snap_1764033034172_0",
"bundlePath": "src/components/context.json",
"rootComponent": "Button",
"bundle": {
"position": "1/20",
"type": "LogicStampBundle",
"schemaVersion": "0.3",
"entryId": "src/components/Button.tsx",
"depth": 1,
"createdAt": "2024-01-15T10:30:00Z",
"bundleHash": "abc123def456",
"graph": {
"nodes": [
{
"entryId": "src/components/Button.tsx",
"contract": {
"type": "UIFContract",
"schemaVersion": "0.3",
"kind": "react:component",
"entryId": "src/components/Button.tsx",
"entryPathAbs": "/absolute/path/src/components/Button.tsx",
"entryPathRel": "src/components/Button.tsx",
"description": "Interactive button component with variant support",
"version": {
"hooks": ["useState"],
"components": ["Icon"],
"imports": ["react", "./Icon"]
},
"logicSignature": {
"props": {
"variant": {
"type": "\"primary\" | \"secondary\" | \"tertiary\"",
"optional": true,
"description": "Button style variant"
},
"onClick": {
"type": "(event: MouseEvent) => void",
"optional": true,
"description": "Click handler"
},
"children": {
"type": "React.ReactNode",
"optional": false
}
},
"emits": {},
"state": {
"isPressed": "boolean"
}
},
"exports": {
"default": "Button"
},
"semanticHash": "hash123",
"fileHash": "file456"
},
"codeHeader": "@uif contract...",
"fullCode": null
}
],
"edges": [
{
"from": "src/components/Button.tsx",
"to": "src/components/Icon.tsx",
"type": "dependency"
}
]
},
"meta": {
"missing": [],
"source": "stamp"
}
}
}When includeStyle: true was used in refresh_snapshot, the contract includes a style field:
{
"contract": {
"type": "UIFContract",
// ... other fields ...
"style": {
"styleSources": {
"tailwind": {
"categories": {
"layout": ["flex", "items-center", "justify-center"],
"spacing": ["px-4", "py-2", "mb-4"],
"colors": ["bg-blue-500", "text-white", "hover:bg-blue-600"],
"typography": ["text-lg", "font-semibold"],
"borders": ["rounded-lg", "border-2"],
"effects": ["shadow-md", "transition"]
},
"breakpoints": ["md", "lg"],
"classCount": 12
}
},
"layout": {
"type": "flex",
"hasHeroPattern": false,
"hasFeatureCards": false
},
"visual": {
"colors": ["blue-500", "white", "blue-600"],
"spacing": ["px-4", "py-2", "mb-4"],
"radius": "lg",
"typography": ["text-lg", "font-semibold"]
}
}
}
}This is STEP 3 of the LogicStamp MCP workflow:
- ✅ Call
logicstamp_refresh_snapshot- Creates snapshot (STEP 1) - ✅ Call
logicstamp_list_bundles- Lists available bundles (STEP 2) - ✅ Call
logicstamp_read_bundle- Read specific bundles (STEP 3 - you are here)
Access props from bundle.graph.nodes[0].contract.logicSignature.props:
{
variant: {
type: "\"primary\" | \"secondary\"",
optional: true,
description: "Button style variant"
}
}See what components this uses from bundle.graph.edges:
{
from: "src/components/Button.tsx",
to: "src/components/Icon.tsx",
type: "dependency"
}Access state from bundle.graph.nodes[0].contract.logicSignature.state:
{
isPressed: "boolean"
}If includeStyle: true, access style metadata from bundle.graph.nodes[0].contract.style.
- Must call after list_bundles: Use the
bundlePathfromlogicstamp_list_bundlesoutput. - Multiple bundles per file: A single
context.jsonfile can contain multiple bundles. UserootComponentto specify which one. ⚠️ Finding dependencies: If a component isn't found as a root (not inlist_bundles), it's a dependency. Read bundles that might import it and checkbundle.graph.nodes[]for the dependency contract. Dependencies appear in thegraph.nodes[]array of the root component that imports them.- Style metadata: Only available if
includeStyle: truewas used inrefresh_snapshot. - Code inclusion: The
codeHeaderandfullCodefields depend on themodeused inrefresh_snapshot:none- No code includedheader- OnlycodeHeaderincludedfull- BothcodeHeaderandfullCodeincluded
logicstamp_refresh_snapshot- Create snapshot (STEP 1)logicstamp_list_bundles- List bundles (STEP 2)logicstamp_compare_snapshot- Compare snapshots to detect changes
When watch mode (stamp context --watch) is active, this command automatically handles race conditions that can occur when files are being written:
- Initial delay: Adds a small delay before reading files to let watch mode finish writing:
- Regular watch mode: 200ms delay
- Strict watch mode (
--strict-watch): 500ms delay (breaking change detection takes slightly longer)
- Retry logic: If JSON parsing fails (indicating a partially written file), automatically retries up to 3 times with exponential backoff (100ms, 200ms, 400ms)
- Worst case total wait: ~900ms (200ms initial + retries) for regular watch, ~1.1s for strict watch
- Transparent operation: This behavior is automatic and only applies when watch mode is active - no performance impact when watch mode is off
This ensures reliable file reading even when watch mode is actively regenerating context files, with minimal user-perceived latency.
⚠️ Important for AI Assistants: These delays are internal to the MCP tool and handled automatically. Do not usesleep()or other delays before calling this tool - the tool handles all necessary waiting internally. When watch mode is active, bundles are already fresh - just call the tool directly.
If the command fails, it will throw an error with a descriptive message. Common errors:
- Snapshot not found - The
snapshotIddoesn't exist - Bundle not found - The
bundlePathdoesn't exist or therootComponentisn't in that file - Invalid bundle path - The
bundlePathformat is incorrect - No bundles in file - The
context.jsonfile is empty or corrupted - File read errors - When watch mode is active, retries are attempted automatically. If all retries fail, the error will indicate the file may still be writing
- MCP Integration Guide - Complete MCP server documentation
- Tool Description - LogicStamp Context capabilities
- Quick Start - Getting started guide