1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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)
|