diff options
Diffstat (limited to 'src/agentux/tools/repomap_tool.py')
| -rw-r--r-- | src/agentux/tools/repomap_tool.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/agentux/tools/repomap_tool.py b/src/agentux/tools/repomap_tool.py new file mode 100644 index 0000000..c265c51 --- /dev/null +++ b/src/agentux/tools/repomap_tool.py @@ -0,0 +1,49 @@ +"""Repomap tool for Agentux.""" + +from __future__ import annotations + +from typing import Any, Dict +from ..models import ToolDefinition +from ..repomap import RepoMap +from .base import BaseTool + + +class RepomapTool(BaseTool): + """Tool allowing the agent to inspect the codebase symbol outline.""" + + def __init__(self, root: str) -> None: + self.repomap = RepoMap(root) + + @property + def name(self) -> str: + return "repomap" + + @property + def description(self) -> str: + return ( + "Generate a compact, token-efficient repository symbol map. " + "Shows all classes, structs, functions, methods, and line numbers " + "across the codebase without reading entire files. " + "Optionally filter by symbol query or path keyword." + ) + + @property + def parameters(self) -> Dict[str, Any]: + return { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "Optional symbol name, keyword, or path to filter the map.", + }, + "max_tokens": { + "type": "integer", + "description": "Maximum token budget for the map (default 600).", + }, + }, + } + + async def execute(self, **kwargs: Any) -> str: + query = kwargs.get("query") + max_tokens = int(kwargs.get("max_tokens", 600)) + return self.repomap.generate_map(max_tokens=max_tokens, query=query) |
