-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_index.yaml
More file actions
255 lines (237 loc) · 8.4 KB
/
Copy path_index.yaml
File metadata and controls
255 lines (237 loc) · 8.4 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
version: "1.0"
namespace: code_tools
entries:
- name: definition
kind: ns.definition
readme: file://README.md
meta:
title: Code Analysis Tools
description: MCP tools for Tree-sitter code analysis — parse, query, extract symbols and diagnose syntax errors
- name: dependency.mcp
kind: ns.dependency
component: butschster/mcp-server
version: ">=0.1.0"
# ===========================================================================
# Shared Libraries
# ===========================================================================
- name: parser_lib
kind: library.lua
source: file://parser_lib.lua
modules:
- fs
- registry
- treesitter
- json
- name: queries_lib
kind: library.lua
source: file://queries_lib.lua
# ===========================================================================
# Tools
# ===========================================================================
# --- code_languages: list supported languages ---
- name: code_languages
kind: function.lua
source: file://code_languages.lua
method: call
modules:
- treesitter
imports:
parser: code_tools:parser_lib
queries: code_tools:queries_lib
meta:
mcp.tool: true
mcp.name: "code_languages"
mcp.description: "List all supported programming languages for code analysis tools, including file extension mappings and available query patterns."
mcp.inputSchema:
type: "object"
mcp.annotations:
readOnlyHint: true
# --- code_parse: syntax tree ---
- name: code_parse
kind: function.lua
source: file://code_parse.lua
method: call
modules:
- json
- treesitter
imports:
parser: code_tools:parser_lib
meta:
mcp.tool: true
mcp.name: "code_parse"
mcp.description: "Parse source code into a syntax tree (AST) and display its structure. Supports all Tree-sitter languages. Provide code directly or read from a project file."
mcp.inputSchema:
type: "object"
properties:
code:
type: "string"
description: "Source code to parse. Either 'code'+'language' or 'path' is required."
language:
type: "string"
description: "Programming language (e.g. 'go', 'python', 'javascript'). Required with 'code', auto-detected with 'path'."
path:
type: "string"
description: "File path relative to project root. Language is auto-detected from extension."
project:
type: "string"
description: "Project identifier (optional, uses default project)."
depth:
type: "integer"
description: "Maximum tree depth to display (default: 3, max: 20)."
minimum: 0
maximum: 20
mcp.annotations:
readOnlyHint: true
# --- code_outline: structural overview ---
- name: code_outline
kind: function.lua
source: file://code_outline.lua
method: call
modules:
- json
- treesitter
imports:
parser: code_tools:parser_lib
queries: code_tools:queries_lib
meta:
mcp.tool: true
mcp.name: "code_outline"
mcp.description: "Generate a structural outline of source code showing functions, types/classes, imports, and variables with line numbers. Uses language-specific query patterns for accurate extraction."
mcp.inputSchema:
type: "object"
properties:
code:
type: "string"
description: "Source code to analyze. Either 'code'+'language' or 'path' is required."
language:
type: "string"
description: "Programming language (e.g. 'go', 'python', 'lua'). Required with 'code', auto-detected with 'path'."
path:
type: "string"
description: "File path relative to project root. Language is auto-detected from extension."
project:
type: "string"
description: "Project identifier (optional, uses default project)."
mcp.annotations:
readOnlyHint: true
# --- code_symbols: flat symbol list ---
- name: code_symbols
kind: function.lua
source: file://code_symbols.lua
method: call
modules:
- json
- treesitter
imports:
parser: code_tools:parser_lib
queries: code_tools:queries_lib
meta:
mcp.tool: true
mcp.name: "code_symbols"
mcp.description: "Extract all symbols (functions, types, imports, variables) from source code as a flat searchable list. Supports filtering by symbol kind and name pattern."
mcp.inputSchema:
type: "object"
properties:
code:
type: "string"
description: "Source code to analyze. Either 'code'+'language' or 'path' is required."
language:
type: "string"
description: "Programming language. Required with 'code', auto-detected with 'path'."
path:
type: "string"
description: "File path relative to project root."
project:
type: "string"
description: "Project identifier (optional)."
kind:
type: "string"
description: "Filter by symbol kind: 'function', 'type', 'import', 'variable', 'export'."
enum:
- "function"
- "type"
- "import"
- "variable"
- "export"
filter:
type: "string"
description: "Filter symbols by name pattern (Lua pattern match)."
mcp.annotations:
readOnlyHint: true
# --- code_query: custom Tree-sitter queries ---
- name: code_query
kind: function.lua
source: file://code_query.lua
method: call
modules:
- json
- treesitter
imports:
parser: code_tools:parser_lib
meta:
mcp.tool: true
mcp.name: "code_query"
mcp.description: "Run a custom Tree-sitter S-expression query against source code. Returns all captures with name, position, and text. Useful for advanced pattern matching like finding all error handling blocks, specific function calls, or structural patterns."
mcp.inputSchema:
type: "object"
properties:
query:
type: "string"
description: "Tree-sitter query in S-expression syntax, e.g. '(function_declaration name: (identifier) @name)'"
code:
type: "string"
description: "Source code to query. Either 'code'+'language' or 'path' is required."
language:
type: "string"
description: "Programming language. Required with 'code', auto-detected with 'path'."
path:
type: "string"
description: "File path relative to project root."
project:
type: "string"
description: "Project identifier (optional)."
limit:
type: "integer"
description: "Maximum captures to return (default: 100, max: 500)."
minimum: 1
maximum: 500
required:
- "query"
mcp.annotations:
readOnlyHint: true
# --- code_diagnostics: syntax error detection ---
- name: code_diagnostics
kind: function.lua
source: file://code_diagnostics.lua
method: call
modules:
- json
- treesitter
imports:
parser: code_tools:parser_lib
meta:
mcp.tool: true
mcp.name: "code_diagnostics"
mcp.description: "Check source code for syntax errors using Tree-sitter. Reports error locations, missing tokens, and surrounding context. Works even with partially broken code (Tree-sitter is error-tolerant)."
mcp.inputSchema:
type: "object"
properties:
code:
type: "string"
description: "Source code to check. Either 'code'+'language' or 'path' is required."
language:
type: "string"
description: "Programming language. Required with 'code', auto-detected with 'path'."
path:
type: "string"
description: "File path relative to project root."
project:
type: "string"
description: "Project identifier (optional)."
limit:
type: "integer"
description: "Maximum errors to report (default: 50, max: 200)."
minimum: 1
maximum: 200
mcp.annotations:
readOnlyHint: true