-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode_index.lua
More file actions
38 lines (32 loc) · 1.1 KB
/
code_index.lua
File metadata and controls
38 lines (32 loc) · 1.1 KB
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
-- MCP Tool: code_index
-- Trigger indexing of a PHP project for cross-file analysis
-- Entry kind: function.lua
local tools = require("tools")
local fmt = require("fmt")
local function call(arguments)
-- Check if already indexed (unless force)
if not arguments.force then
local status, _ = tools.check_index()
if status and status.indexed and status.project == arguments.project then
local s = status.stats
return string.format(
"# Already Indexed\n\n"
.. "Project: %s\n"
.. "Files: %d | Symbols: %d | References: %d\n\n"
.. "Use `force: true` to re-index.",
status.project or "default",
s.files, s.symbols, s.references
)
end
end
-- Trigger indexing
local result, err = tools.request("index", {
project = arguments.project,
path = arguments.path,
}, "60s") -- Indexing can take longer
if err then
return tools.format_error(err)
end
return fmt.format_index_stats(result)
end
return { call = call }