Skip to content

Commit 12c4859

Browse files
committed
style(mcp): satisfy filter lint
1 parent aaa00a3 commit 12c4859

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

‎src/agents/agent-bundle-mcp-filter.ts‎

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
/** Match the documented MCP tool-filter glob syntax: exact text plus `*`. */
22
export function matchesMcpToolFilterPattern(pattern: string, value: string): boolean {
33
const trimmed = pattern.trim();
4-
if (!trimmed) return false;
5-
if (!trimmed.includes("*")) return trimmed === value;
4+
if (!trimmed) {
5+
return false;
6+
}
7+
if (!trimmed.includes("*")) {
8+
return trimmed === value;
9+
}
610

711
const parts = trimmed.split("*");
812
const first = parts[0] ?? "";
913
const last = parts.at(-1) ?? "";
1014
let cursor = 0;
1115
if (first) {
12-
if (!value.startsWith(first)) return false;
16+
if (!value.startsWith(first)) {
17+
return false;
18+
}
1319
cursor = first.length;
1420
}
1521
const endBound = last ? value.length - last.length : value.length;
16-
if (last && (!value.endsWith(last) || endBound < cursor)) return false;
22+
if (last && (!value.endsWith(last) || endBound < cursor)) {
23+
return false;
24+
}
1725

1826
for (const part of parts.slice(1, -1)) {
19-
if (!part) continue;
27+
if (!part) {
28+
continue;
29+
}
2030
const index = value.indexOf(part, cursor);
21-
if (index === -1 || index + part.length > endBound) return false;
31+
if (index === -1 || index + part.length > endBound) {
32+
return false;
33+
}
2234
cursor = index + part.length;
2335
}
2436
return true;

0 commit comments

Comments
 (0)