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

Function expandToolPatterns

src/tools/registry.ts:137–152  ·  view source on GitHub ↗
(patterns: string[], allNames: string[])

Source from the content-addressed store, hash-verified

135 // NB: the real edit tool is `edit_text` (there is no `edit_file`). Protecting the phantom
136 // name left the actual editor gate-able by tool-profiling — a latent "can't edit" bug.
137 'shell', 'read_file', 'write_file', 'edit_text', 'edit_symbol', 'multi_edit', 'ls', 'glob', 'grep',
138]);
139export function expandToolPatterns(patterns: string[], allNames: string[]): string[] {
140 const out = new Set<string>();
141 for (const raw of patterns) {
142 const p = raw.trim();
143 if (!p) continue;
144 if (p.endsWith('*')) {
145 const prefix = p.slice(0, -1);
146 if (!prefix) continue; // bare "*" would block everything — refuse
147 for (const n of allNames) if (n.startsWith(prefix)) out.add(n);
148 } else if (allNames.includes(p)) {
149 out.add(p);
150 }
151 }
152 for (const core of NEVER_BLOCK) out.delete(core);
153 return [...out].sort();
154}
155

Callers 2

tool-diet.test.tsFile · 0.85
runMethod · 0.85

Calls 2

addMethod · 0.80
deleteMethod · 0.80

Tested by

no test coverage detected