Context Search Tool
Context-aware full-text search across your codebase
The Context Search tool (noodlbox_query_with_context) performs intelligent full-text searches that understand your current task and goals. Unlike simple text matching, this tool ranks results based on relevance to what you're trying to accomplish.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
repository | string | Yes | Repository name to search |
q | string | Yes | Natural language search query |
task_context | string | Yes | What task you're working on |
current_goal | string | Yes | Your current objective |
search_intention | string | Yes | Why you're searching |
include_content | boolean | No | Include full symbol content (default: false) |
limit | number | No | Max processes to return (1-100, default: 10) |
max_symbols | number | No | Symbols per process (1-100, default: 20) |
Basic Usage
Find Authentication Code
{
"repository": "my-app",
"q": "user authentication login",
"task_context": "Adding OAuth support",
"current_goal": "Understand existing auth flow",
"search_intention": "Find auth-related functions to integrate with"
}Locate Error Handling
{
"repository": "my-app",
"q": "error handling exceptions",
"task_context": "Debugging production error",
"current_goal": "Find where errors are caught",
"search_intention": "Trace error propagation path"
}Context Parameters Explained
task_context
Describe what you're currently working on. This helps the search understand which results are most relevant.
Examples:
- "Adding new payment integration"
- "Fixing memory leak in data processing"
- "Refactoring authentication module"
current_goal
Specify your immediate objective. This focuses the search on results that help achieve this goal.
Examples:
- "Understand how payments are processed"
- "Find all database connection points"
- "Locate test setup code"
search_intention
Explain why you're searching. This helps rank results by how useful they'll be.
Examples:
- "Need to add similar functionality"
- "Looking for examples of this pattern"
- "Finding code to refactor"
- "Understanding system behavior"
Response Format
Results are organized hierarchically: Processes -> Symbols
interface ContextSearchResponse {
processes: ProcessResult[];
total_processes: number;
truncated: boolean;
}
interface ProcessResult {
process_id: string;
process_label: string;
process_type: 'intra_community' | 'cross_community';
relevance_score: number;
symbols: SymbolResult[];
}
interface SymbolResult {
symbol_name: string;
symbol_type: string; // "Function", "Class", "Variable", etc.
file_path: string;
line_number?: number;
content?: string; // If include_content is true
}Example Response
{
"processes": [
{
"process_id": "abc123",
"process_label": "UserAuthentication",
"process_type": "intra_community",
"relevance_score": 0.95,
"symbols": [
{
"symbol_name": "authenticateUser",
"symbol_type": "Function",
"file_path": "src/auth/authenticate.ts",
"line_number": 45
},
{
"symbol_name": "validateToken",
"symbol_type": "Function",
"file_path": "src/auth/token.ts",
"line_number": 23
}
]
}
],
"total_processes": 1,
"truncated": false
}Advanced Features
Process-Grouped Results
Results are automatically grouped by process, making it easier to understand how code fits together:
{
"q": "database query",
"task_context": "Optimizing database performance",
"current_goal": "Find slow queries",
"search_intention": "Identify queries to optimize"
}This returns processes like "DatabaseAccess", "UserRepository", etc., each containing related symbols.
Pagination
For large result sets, use pagination:
{
"q": "api endpoint",
"limit": 5, // Return 5 processes
"max_symbols": 10 // Up to 10 symbols per process
}Including Symbol Content
Get full symbol definitions by setting include_content:
{
"q": "payment processing",
"include_content": true
}Including content significantly increases response size. Use sparingly for targeted searches.
Search Strategies
Strategy 1: Broad Discovery
Start broad to understand what's available:
{
"q": "payment",
"task_context": "Adding payment features",
"current_goal": "Explore payment-related code",
"search_intention": "Get overview of payment system",
"limit": 20
}Strategy 2: Focused Investigation
Narrow down to specific functionality:
{
"q": "stripe webhook handler",
"task_context": "Fixing webhook processing",
"current_goal": "Find webhook handler code",
"search_intention": "Debug webhook failures",
"limit": 5,
"include_content": true
}Strategy 3: Pattern Matching
Find similar implementations:
{
"q": "react component form validation",
"task_context": "Creating new form",
"current_goal": "Find validation examples",
"search_intention": "Reuse existing validation patterns"
}Best Practices
1. Provide Rich Context
Good:
{
"q": "user profile",
"task_context": "Implementing profile edit feature",
"current_goal": "Understand existing profile structure",
"search_intention": "Find profile models and update logic"
}Less effective:
{
"q": "user profile",
"task_context": "Working on code",
"current_goal": "Find stuff",
"search_intention": "Looking around"
}2. Use Natural Language
The search understands natural language queries:
- "how to handle user authentication"
- "error logging and monitoring"
- "database connection pooling"
3. Iterate Your Search
Refine searches based on results:
- Start broad: "authentication"
- Focus: "JWT token validation"
- Specific: "token expiry handling"
4. Adjust Result Limits
Balance comprehensiveness with performance:
- Quick overview:
limit: 5 - Thorough investigation:
limit: 20 - Exhaustive search:
limit: 100
Troubleshooting
Too Many Results
- Make query more specific
- Reduce
limitandmax_symbols - Add more detail to context parameters
Not Finding Expected Code
- Try different search terms
- Broaden context parameters
- Increase
limitparameter - Try searching for file names or specific function names
Results Not Relevant
- Refine
task_contextto be more specific - Adjust
current_goalto better describe what you need - Make
search_intentionmore explicit
Performance Tips
- Start small: Use low limits initially, increase as needed
- Skip content: Don't use
include_contentunless necessary - Be specific: More specific queries return faster
- Use pagination: Fetch results in batches for large searches
Related
- Cypher Query Tool - For more precise graph queries
- Codebase Map Resource - Understand code structure
- Code Exploration - Discovery workflows