fix(server): schema preflight for tool call (#15172)

This commit is contained in:
OrbisAI Security
2026-07-05 01:23:44 +05:30
committed by GitHub
parent 06a89d478e
commit a7f824c42b
2 changed files with 123 additions and 2 deletions
@@ -1,3 +1,5 @@
import { z } from 'zod';
import {
type LlmBackendConfig,
llmDispatchToolLoopStream,
@@ -63,7 +65,7 @@ export function createToolExecutionCallback(
};
}
async function executeToolCall(
export async function executeToolCall(
tools: CopilotToolSet,
request: LlmToolCallbackRequest,
options: CopilotToolExecuteOptions
@@ -103,7 +105,11 @@ async function executeToolCall(
}
try {
const output = await tool.execute(request.args, options);
const args =
tool.inputSchema instanceof z.ZodType
? tool.inputSchema.parse(request.args)
: request.args;
const output = await tool.execute(args, options);
return {
callId: request.callId,
name: request.name,
@@ -173,3 +179,7 @@ export function createToolLoopBridge(
);
};
}
// re-export for test consumers
export type { LlmToolCallbackRequest } from '../../../../native';
export type { CopilotToolSet, CopilotToolExecuteOptions } from '../../tools';