Search Tools¶
Tools for finding code, documentation, and lessons in your knowledge base.
smart_search (Default)¶
Intelligent search that routes your query to the best tool (Graph, KV, or Vector).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Natural language query |
project_id |
string | (current) | Project context | |
session_id |
string | - | Session context (for "recent messages" etc) |
Example¶
smart_search("what calls authenticate_user")
# -> Routes to find_callers
smart_search("how does authentication work")
# -> Routes to search_knowledge (Vector)
smart_search("what was the last error")
# -> Routes to get_recent_context (KV)
search_knowledge¶
Search all indexed content with optional type filtering.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Natural language search query |
content_type |
string | "all" |
Filter: all, code, documentation, lesson |
|
project_id |
string | (current) | Project to search (omit for all projects) | |
limit |
int | 5 |
Maximum results (max: 20) |
Example¶
Response:
## Search Results [CODE]: 'function that handles user authentication'
### Result 1: [CODE] authenticate_user
**File:** `src/auth/user.py`
**Type:** function (python)
**Lines:** 45-62
```python
def authenticate_user(username: str, password: str) -> User:
"""Authenticate a user with username and password."""
user = db.get_user(username)
if not user or not verify_password(password, user.password_hash):
raise AuthenticationError("Invalid credentials")
return user
```
search_code¶
Search specifically in indexed code (functions, classes, methods).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Description of code to find |
project_id |
string | (all) | Project to search | |
limit |
int | 5 |
Maximum results |
Example¶
search_docs¶
Search specifically in documentation (Markdown, RST, text).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Search query |
project_id |
string | (all) | Project to search | |
limit |
int | 5 |
Maximum results |
Example¶
search_lessons¶
Search recorded lessons (problems and solutions).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Problem description or error message |
project_id |
string | (all) | Project to search | |
limit |
int | 5 |
Maximum results |
Example¶
Cross-Project Learning
Omit project_id to search lessons across all projects. Solutions from one project can help with similar issues in others.
search_insights¶
Search recorded insights (discoveries, mistakes, optimizations).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | What you're looking for |
category |
string | (all) | Filter: mistake, discovery, backtrack, optimization |
|
project_id |
string | (all) | Project to search | |
limit |
int | 5 |
Maximum results |
Example¶
search_implementations¶
Search recorded implementation summaries.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | ✅ | - | Feature or approach to find |
project_id |
string | (all) | Project to search | |
limit |
int | 5 |
Maximum results |
Example¶
set_session_context¶
Store session context for search suggestions. Use this to help Nexus-Dev provide relevant search recommendations based on the current task.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
session_id |
string | ✅ | - | Unique session identifier |
current_task |
string | - | Description of current task | |
recent_files |
array | - | List of recently edited files | |
metadata |
object | - | Additional context |
Example¶
set_session_context(
session_id="user-session-123",
current_task="Implement user authentication",
recent_files=["src/auth/login.py", "src/auth/jwt.py"],
metadata={"language": "python"}
)
get_session_context¶
Retrieve stored session context.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
session_id |
string | ✅ | - | Session ID |
Example¶
Response:
Session: user-session-123
Current Task: Implement user authentication
Recent Files:
- src/auth/login.py
- src/auth/jwt.py
Metadata:
- language: python
get_search_suggestions¶
Get contextual search suggestions based on the current session.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
session_id |
string | ✅ | - | Session ID |
limit |
int | 5 |
Max suggestions |
Example¶
Response:
## Search Suggestions
Based on your current task: "Implement user authentication"
1. **search_code**: "JWT token validation function"
2. **search_docs**: "authentication configuration"
3. **search_lessons**: "previous authentication bugs"
4. **search_knowledge**: "password hashing implementation"
**Tip:** Use set_session_context to update your current task.
Session Context
Set session context at the start of your work session to receive relevant search suggestions throughout your session.
Best Practices¶
-
Start broad, then narrow: Use
search_knowledgefirst, then switch to specific tools if needed. -
Use natural language: "function that validates email addresses" works better than "email_validator".
-
Search lessons early: When encountering an error, search lessons before debugging from scratch.
-
Cross-project search: Omit
project_idwhen looking for patterns that might exist in other projects.
search_dependencies¶
Find code dependencies using the graph database.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
target |
string | ✅ | - | File path or module name |
direction |
string | both |
imports, imported_by, both |
|
depth |
int | 1 |
Traversal depth (max 5) | |
project_id |
string | (current) | Project context |
Example¶
find_callers¶
Find all functions that call the specified function.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
function_name |
string | ✅ | - | Name of function to find callers for |
project_id |
string | (current) | Project context |
Example¶
find_implementations¶
Find all classes that inherit from the specified class.
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
class_name |
string | ✅ | - | Base class name |
project_id |
string | (current) | Project context |
Example¶
get_recent_context¶
Get recent chat messages from the session history (KV store).
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
session_id |
string | ✅ | - | Session ID |
limit |
int | 20 |
Max messages |