@@ -462,62 +462,71 @@ async def search_code(
462462 include_content : bool = True
463463) -> str :
464464 """
465- Search for code snippets across the provided data sources using natural language or code patterns.
466-
465+ SEMANTIC search across your codebases.
466+
467+ This endpoint is optimized for **natural-language** questions and intent-driven queries
468+ (not rigid templates). Ask it things like:
469+ • "What is the authentication flow?"
470+ • "Where is the user registration logic implemented?"
471+ • "How do services communicate with the billing API?"
472+ • "Where is rate limiting handled?"
473+ • "Show me how we validate JWTs."
474+
475+ You can still include function/class names if you know them, but it's not required.
476+
467477 Args:
468- query: The search query - can be natural language ("find authentication code") or code patterns ("function getUserById")
469- For best results, be specific and include relevant keywords or function/class names
470- Example: "implement JWT token validation"
471-
472- data_source_ids: List of data source IDs to search in (required)
473- Can be workspace IDs (to search across all repositories in the workspace)
474- or individual repository IDs for more targeted searches.
475- Example: ["67f664fd4c2a00698a52bb6f", "5e8f9a2c1d3b7e4a6c9d0f8e"]
476-
478+ query: A natural-language description of what you're looking for.
479+ Prefer questions/phrases over template strings.
480+ Examples: "What initializes the database connection?",
481+ "Where do we parse OAuth callbacks?",
482+ "user registration controller"
483+
484+ data_source_ids: List of data source IDs to search in (required).
485+ Can be workspace IDs (search all repositories in the workspace)
486+ or individual repository IDs for targeted searches.
487+ Example: ["67f664fd4c2a00698a52bb6f", "5e8f9a2c1d3b7e4a6c9d0f8e"]
488+
477489 mode: Search mode (case-insensitive):
478- - "auto": (Default) RECOMMENDED - Intelligently adapts search depth based on query complexity
479- - "fast": Quick scan for exact matches, best for simple queries and large codebases
480- - "fast_deeper": Balanced search with moderate semantic analysis, good for general use
481- - "deep": Use SPARINGLY - Resource-intensive thorough semantic analysis, only for very complex
482- conceptual queries when other modes fail to yield results
483- Example: "auto"
484-
485- include_content: Whether to include the full file content in results (default: true)
486- Set to false for faster, more concise results when only locations are needed
487- Example: true
488-
490+ - "auto": (Default, recommended) Adaptive semantic search.
491+ - "fast": Lightweight/lexical pass; quickest for obvious matches.
492+ - "fast_deeper": Balanced semantic + lexical search for general use.
493+ - "deep": Exhaustive semantic exploration; use sparingly for hard,
494+ cross-cutting questions.
495+
496+ include_content: Whether to include full file content in results (default: true).
497+ Set to false for faster, more concise results when only locations are needed.
498+
489499 Returns:
490500 Formatted search results including:
491501 - Source repository/workspace name and type
492502 - File path
493503 - Line numbers
494504 - Code snippet showing the matching section
495505 - Full file content (if include_content=true)
496-
506+
497507 Examples:
498- 1. Find authentication implementation (using default auto mode - recommended):
499- search_code(query="user authentication implementation ", data_source_ids=["repo123"])
500-
501- 2. Find a specific function quickly :
502- search_code(query="calculateTotalPrice function ", data_source_ids=["repo123"], mode="fast" )
503-
504- 3. Search across an entire workspace :
505- search_code(query="database connection ", data_source_ids=["workspace456"])
506-
507- 4. Search across specific repositories from different workspaces :
508- search_code(query="authentication flow ", data_source_ids=["repo123", "repo789 "])
509-
510- 5. Get concise results without full file contents:
511- search_code(query="password reset", data_source_ids=["repo123"], include_content=false)
512-
508+ 1. Natural-language question ( recommended):
509+ search_code(query="What is the auth flow? ", data_source_ids=["repo123"])
510+
511+ 2. Intent query :
512+ search_code(query="Where is user registration logic? ", data_source_ids=["repo123"])
513+
514+ 3. Workspace-wide question :
515+ search_code(query="How do microservices talk to the billing API? ", data_source_ids=["workspace456"])
516+
517+ 4. Mixed query with a known identifier :
518+ search_code(query="Where do we validate JWTs (AuthService)? ", data_source_ids=["repo123"])
519+
520+ 5. Concise results without full file contents:
521+ search_code(query="Where is password reset handled? ", data_source_ids=["repo123"], include_content=false)
522+
513523 Note:
514524 - At least one data_source_id must be provided
515525 - All data sources must be in "Alive" state
516526 - The API key must have access to the specified data sources
517- - Always start with "auto" mode first, as it intelligently chooses the appropriate search strategy
518- - The "deep" mode should only be used when absolutely necessary as it's resource-intensive
519- - For finding specific implementations, include function names in your query
520- - For understanding architectural patterns, use natural language descriptions
527+ - Prefer natural-language questions; templates are unnecessary.
528+ - Start with "auto" for best semantic results; escalate to "deep" only if needed.
529+ - If you know precise symbols (functions/classes), include them to narrow scope.
521530 """
522531 # Get context
523532 context : CodeAliveContext = ctx .request_context .lifespan_context
0 commit comments