Follow the breadcrumbs through your codebase. Map out exactly how data flows from entry point to result, across files and modules, turning complex workflows into clear visual paths.
Quick Start
Jump in with these practical examples. Perfect for those "where does this actually go?" moments:
Please trace the execution path starting from UserController::login in my project at C:/my-app
Trace how data flows through processPayment function in C:/api/payments
Can you map the execution path for handleOrderSubmission and show me parameter details?
Perfect for Legacy Code
This is brilliant when you've inherited a complex codebase and need to understand how everything connects. It's like having a map of the code's journey.
What It Does
Ever found yourself clicking through files trying to understand how a function actually works? trace_execution_path
does that detective work for you, starting from any entry point and mapping out the complete journey your code takes.
Think of it as your personal code archaeologist. It excavates the execution path, uncovering:
- Function Call Sequences - See exactly which functions call which, in order
- Cross-File Flow - Follow the path as it jumps between files and modules
- Data Transformation Points - Track how data changes as it moves through your system
- Decision Points - Identify where conditions and logic branches occur
- Performance Bottlenecks - Spot potentially slow operations in the execution chain
- Architectural Insights - Understand the actual structure of your system's workflows
This isn't just a static analysis - it understands the dynamic flow of execution, helping you see the wood for the trees in complex codebases.
Parameters
Customise your trace to get exactly the insights you need:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
entryPoint |
string | Yes | - |
Where to start tracing from Examples:
"UserController::login" , "processPayment" , "handleSubmit" |
projectPath |
string | Yes* | - |
Path to your project root directory Example:
"C:/my-project" |
filePath |
string | Yes* | - |
Single file to trace within (alternative to projectPath) Use when you know the specific file
|
traceDepth |
number | No | 5 |
How many levels deep to trace (1-10) Start with 5, increase for deeper analysis
|
showParameters |
boolean | No | false |
Include parameter information in the trace Helpful for debugging data flow issues
|
analysisDepth |
string | No | "detailed" |
Analysis detail level: "basic", "detailed", "comprehensive" Use "comprehensive" for complex workflows
|
maxDepth |
number | No | 3 |
Maximum directory depth for file discovery (1-5) Increase for deeply nested projects
|
*Either projectPath or filePath is required - use projectPath for cross-file tracing
Real-World Examples
Here's how to trace different types of workflows:
π Authentication Flow Tracing
houtini-lm:trace_execution_path with:
- entryPoint: "AuthController::login"
- projectPath: "C:/my-app"
- traceDepth: 7
- showParameters: true
- analysisDepth: "comprehensive"
π° Payment Processing Pipeline
houtini-lm:trace_execution_path with:
- entryPoint: "PaymentService::processPayment"
- projectPath: "C:/ecommerce-api"
- traceDepth: 6
- showParameters: true
- analysisDepth: "detailed"
π Data Processing Workflow
houtini-lm:trace_execution_path with:
- entryPoint: "DataProcessor::handleBatchUpload"
- projectPath: "C:/analytics-platform"
- traceDepth: 8
- showParameters: false
- analysisDepth: "comprehensive"
π E-commerce Order Flow
houtini-lm:trace_execution_path with:
- entryPoint: "OrderController::submit"
- projectPath: "C:/shop-api"
- traceDepth: 5
- showParameters: true
- analysisDepth: "detailed"
π§ Single File Function Analysis
houtini-lm:trace_execution_path with:
- entryPoint: "validateUserInput"
- filePath: "C:/utils/validation.js"
- traceDepth: 3
- showParameters: true
What You Get Back
The trace delivers a comprehensive map of your code's journey:
πΊοΈ Complete Execution Path
- Sequential call chain showing the exact order of function calls
- File transitions - see when execution jumps between modules
- Depth indicators showing the call stack level at each point
- Return paths documenting how data comes back up the chain
π Cross-File Flow Mapping
- Module dependencies revealed through actual execution paths
- Import/export relationships that matter in practice
- Inter-service communication patterns and data exchange points
- Third-party integrations and external service calls
π Data Transformation Tracking
- Parameter passing - see what data goes where (when showParameters is enabled)
- Data validation points where input gets checked or transformed
- Error handling branches showing exception paths
- Database interactions and external API calls
β‘ Performance Bottleneck Identification
- Complex calculation chains that might be slow
- Database query sequences that could cause N+1 problems
- Nested loops and recursive operations
- External service calls that could timeout or fail
ποΈ Architectural Insights
- System structure revealed through actual execution patterns
- Separation of concerns analysis based on call patterns
- Coupling identification - which parts are tightly connected
- Design pattern recognition in the execution flow
π Visual Flow Representation
- Hierarchical call tree showing the execution structure
- Decision point markers where logic branches occur
- Error handling paths clearly marked
- Return value flow showing how data comes back
Pro Insight
The trace often reveals architectural patterns and potential issues that aren't obvious from looking at individual files. It's like seeing the forest for the first time instead of just individual trees.
Perfect Use Cases
Here's when execution tracing becomes your secret weapon:
π΅οΈ Legacy Code Investigation
Inherited a mysterious codebase? Start with the main entry points and trace through to understand how everything connects. Perfect for those "I have no idea what this system does" moments.
π Complex Bug Hunting
When a bug only appears under specific conditions, trace the execution path to see exactly what code runs and where things might go wrong. Especially powerful for intermittent issues.
β‘ Performance Investigation
Something's running slow? Trace the execution to identify bottlenecks, unnecessary operations, or inefficient data flow patterns that might be causing performance issues.
π Workflow Documentation
Need to document complex business processes? The execution trace gives you the definitive map of how your system handles key workflows, perfect for onboarding or compliance documentation.
ποΈ Refactoring Planning
Before making significant changes, trace through the affected paths to understand the full impact. See which other parts of the system might be affected by your changes.
π Security Analysis
Trace authentication and authorisation flows to ensure security checks happen at the right points and data doesn't bypass validation steps.
π§ͺ Testing Strategy
Use execution traces to identify the critical paths that need comprehensive testing. Focus your testing efforts on the routes your data actually takes.
π Code Review Preparation
Before reviewing or explaining complex code, trace through it to understand the complete workflow. Makes code reviews more effective and educational.
Best Practices
Get the most insightful traces with these proven approaches:
π― Choose Smart Entry Points
- Start with user-facing actions - login, submit, process, create
- Pick meaningful business operations rather than utility functions
- Focus on main workflows before diving into edge cases
- Use descriptive function names - UserController::login is clearer than login()
βοΈ Optimise Trace Depth
- Start with 5 levels - perfect for most workflows
- Increase to 7-8 for complex business processes
- Use 3-4 levels for quick overviews or simple functions
- Go to 10 levels only for deep architectural analysis
π Use Parameters Strategically
- Enable showParameters when debugging data flow issues
- Disable for architectural overviews to keep the trace clean
- Always use for payment/authentication flows - data matters here
- Consider performance - parameter tracking makes traces longer
π Combine with Other Analysis
- Start with project structure analysis using count_files
- Follow up with single file analysis for problematic areas
- Use security audit on critical paths identified in traces
- Apply dependency analysis to understand cross-file relationships
π― Focus Your Analysis
- Use "detailed" analysis for most day-to-day tracing
- Choose "comprehensive" for complex workflows or unknown code
- Try "basic" first for very large or slow codebases
- Match analysis depth to your goals - overview vs deep understanding
Performance Tip
Very deep traces (8+ levels) with parameter tracking can take longer to process. Start with moderate depth and expand if needed. The insights are worth it, but plan accordingly.
Troubleshooting
Having trouble with your traces? Here are solutions to common issues:
Entry point not found or trace stops immediately
The trace can't find your starting function or stops after one step.
- Check the entry point format: use
ClassName::methodName
for methods - Ensure the function name is spelled correctly and exists in the codebase
- Try different variations:
UserController.login
vsUserController::login
- Use just the function name if it's not in a class:
processPayment
- Verify the projectPath includes the file containing the entry point
Trace is too shallow or missing important calls
The trace isn't following the full execution path you expected.
- Increase
traceDepth
to 7 or 8 for deeper analysis - Set
analysisDepth
to "comprehensive" for better cross-file detection - Increase
maxDepth
if your project has deeply nested directories - Ensure all relevant files are within the projectPath directory
- Some dynamic calls (eval, variable function names) may not be traced
Trace is too verbose or overwhelming
Getting too much information and can't see the important flow.
- Reduce
traceDepth
to 3 or 4 for a cleaner overview - Set
showParameters
to false to remove parameter details - Use "basic" analysisDepth for simpler output
- Focus on more specific entry points rather than broad functions
- Consider tracing smaller sections of the workflow separately
Missing cross-file function calls
The trace isn't following calls between different files or modules.
- Ensure you're using
projectPath
notfilePath
for cross-file tracing - Use "comprehensive" analysisDepth for better inter-file analysis
- Check that all relevant files are within the project directory
- Some dynamic imports or runtime-loaded modules may not be traced
- Verify file permissions allow reading all project files
Trace takes too long or times out
The tracing operation is taking much longer than expected.
- Reduce
traceDepth
to 5 or lower for initial analysis - Try "basic" analysisDepth first to speed up processing
- Ensure LM Studio has sufficient memory and isn't swapping
- Use a faster model if available, or ensure the current model is fully loaded
- Consider tracing smaller subsections rather than entire workflows
Framework-specific functions not detected
Missing Laravel routes, React hooks, or other framework-specific patterns.
- Include framework context in related analysis functions first
- Use framework-specific entry point formats (e.g., Laravel route names)
- Ensure the analysis includes framework configuration files
- Some magic methods or framework internals may not be fully traced
- Consider using framework-specific debugging tools alongside tracing