Skip to content

Commit b8a5b1b

Browse files
Copilotdata-douser
andcommitted
fix: filter managed CLI flags from additionalArgs to prevent conflicts with post-processing
For tools with post-execution processing (query run, test run, database analyze), flags like --logdir, --evaluator-log, --output, --verbosity, and --tuple-counting are set internally and read back after execution. If these appear in additionalArgs, they would create conflicting duplicates and break post-processing. Now they are filtered out with a warning directing the user to use the corresponding named parameter. Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/dd017a82-a805-40c8-bb2f-4eae0678766d Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
1 parent 76e0ab7 commit b8a5b1b

File tree

4 files changed

+104
-17
lines changed

4 files changed

+104
-17
lines changed

server/dist/codeql-development-mcp-server.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53068,10 +53068,6 @@ var Protocol = class {
5306853068
this._progressHandlers.clear();
5306953069
this._taskProgressTokens.clear();
5307053070
this._pendingDebouncedNotifications.clear();
53071-
for (const info of this._timeoutInfo.values()) {
53072-
clearTimeout(info.timeoutId);
53073-
}
53074-
this._timeoutInfo.clear();
5307553071
for (const controller of this._requestHandlerAbortControllers.values()) {
5307653072
controller.abort();
5307753073
}
@@ -53202,9 +53198,7 @@ var Protocol = class {
5320253198
await capturedTransport?.send(errorResponse);
5320353199
}
5320453200
}).catch((error2) => this._onerror(new Error(`Failed to send response: ${error2}`))).finally(() => {
53205-
if (this._requestHandlerAbortControllers.get(request.id) === abortController) {
53206-
this._requestHandlerAbortControllers.delete(request.id);
53207-
}
53201+
this._requestHandlerAbortControllers.delete(request.id);
5320853202
});
5320953203
}
5321053204
_onprogress(notification) {
@@ -55217,9 +55211,6 @@ var McpServer = class {
5521755211
annotations = rest.shift();
5521855212
}
5521955213
} else if (typeof firstArg === "object" && firstArg !== null) {
55220-
if (Object.values(firstArg).some((v) => typeof v === "object" && v !== null)) {
55221-
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
55222-
}
5522355214
annotations = rest.shift();
5522455215
}
5522555216
}
@@ -55338,9 +55329,6 @@ function getZodSchemaObject(schema2) {
5533855329
if (isZodRawShapeCompat(schema2)) {
5533955330
return objectFromShape(schema2);
5534055331
}
55341-
if (!isZodSchemaInstance(schema2)) {
55342-
throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");
55343-
}
5534455332
return schema2;
5534555333
}
5534655334
function promptArgumentsFromSchema(schema2) {
@@ -57350,8 +57338,25 @@ function registerCLITool(server, definition) {
5735057338
mkdirSync5(outputDir, { recursive: true });
5735157339
}
5735257340
}
57353-
const userAdditionalArgs = Array.isArray(options.additionalArgs) ? options.additionalArgs : [];
57341+
const rawAdditionalArgs = Array.isArray(options.additionalArgs) ? options.additionalArgs : [];
5735457342
delete options.additionalArgs;
57343+
const managedFlagNames = /* @__PURE__ */ new Set([
57344+
"evaluator-log",
57345+
"logdir",
57346+
"output",
57347+
"tuple-counting",
57348+
"verbosity"
57349+
]);
57350+
const userAdditionalArgs = queryLogDir ? rawAdditionalArgs.filter((arg) => {
57351+
const m = arg.match(/^--(?:no-)?([^=]+)/);
57352+
if (m && managedFlagNames.has(m[1])) {
57353+
logger.warn(
57354+
`Ignoring "${arg}" from additionalArgs for ${name}: this flag is managed internally. Use the corresponding named parameter instead.`
57355+
);
57356+
return false;
57357+
}
57358+
return true;
57359+
}) : rawAdditionalArgs;
5735557360
let result;
5735657361
if (command === "codeql") {
5735757362
let cwd;

0 commit comments

Comments
 (0)