MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / listAvailableSymbols

Function listAvailableSymbols

src/tools/ast/edit-symbol.ts:133–156  ·  view source on GitHub ↗
(rootNode: any, nodeTypes: string[])

Source from the content-addressed store, hash-verified

131}
132
133function listAvailableSymbols(rootNode: any, nodeTypes: string[]): string[] {
134 const names: string[] = [];
135 function visit(node: any) {
136 if (nodeTypes.includes(node.type)) {
137 const nameNode = node.childForFieldName('name');
138 if (nameNode) names.push(nameNode.text);
139 else {
140 for (let i = 0; i < node.childCount; i++) {
141 const c = node.child(i);
142 if (c && (c.type === 'identifier' || c.type === 'property_identifier' || c.type === 'type_identifier')) {
143 names.push(c.text);
144 break;
145 }
146 }
147 }
148 }
149 for (let i = 0; i < node.childCount; i++) {
150 const c = node.child(i);
151 if (c) visit(c);
152 }
153 }
154 visit(rootNode);
155 return [...new Set(names)];
156}
157
158export class EditSymbolTool extends Tool<z.infer<typeof ArgsSchema>> {
159 name = 'edit_symbol';

Callers 1

executeMethod · 0.85

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected