discover_side_effects
Discover all potential side effects of a function call: affected files, network, database, and state changes. Pinpoint risks, guide testing, and prevent unintended consequences.
Instructions
Discover all potential side effects of calling a function or method.
Use this tool when you need to understand:
What else might happen when you call a specific function
All the systems/resources that might be affected by a function call
Potential unintended consequences of code changes
What to test or monitor when modifying a function
Critical for understanding the full impact of code changes, planning testing strategies, or debugging issues that might be caused by unexpected side effects.
Args: repo_path: Repository path (absolute) working_directory: Working directory (absolute path) target_function: Name of the function to analyze for side effects side_effect_patterns: Dictionary mapping effect types to regex patterns. Format: {"category": ["regex1", "regex2", ...]}
Example:
{
"file": [r"open\(", r"\.write\(", r"\.read\(", r"os\.remove", r"pathlib\."],
"network": [r"requests\.", r"urllib\.", r"\.get\(", r"\.post\("],
"database": [r"\.execute\(", r"\.query\(", r"\.commit\(", r"session\."],
"global_state": [r"global ", r"os\.environ", r"setattr\("],
"logging": [r"log\.", r"logger\.", r"print\("],
"cache": [r"\.cache", r"redis\.", r"@lru_cache"]
}
Each regex pattern will be searched for in the function body to identify
potential side effects. Use Python regex syntax.
trace_depth: How deep to trace function calls for side effects
include_historical_bugs: Whether to analyze git history for side effect bugsReturns: Comprehensive side effect analysis with risk assessment and mitigation suggestions
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | ||
| trace_depth | No | ||
| target_function | Yes | ||
| working_directory | Yes | ||
| side_effect_patterns | Yes | ||
| include_historical_bugs | No |