Add parameter schema and defaults to ToolResource model and schemas. Implement runtime tool resolution in assistants and tools routers, ensuring proper handling of tool parameters. Update tests to validate new functionality and ensure correct integration of parameter handling in the API.

This commit is contained in:
Xin Wang
2026-02-27 14:44:28 +08:00
parent d942c85eff
commit 5f768edf68
13 changed files with 397 additions and 9 deletions

View File

@@ -2051,13 +2051,20 @@ export const DebugDrawer: React.FC<{
const item = byId.get(id);
const toolId = item?.id || id;
const isClientTool = (item?.category || 'query') === 'system';
const parameterSchema = (item?.parameterSchema && typeof item.parameterSchema === 'object')
? item.parameterSchema
: getDefaultToolParameters(toolId);
const parameterDefaults = (item?.parameterDefaults && typeof item.parameterDefaults === 'object')
? item.parameterDefaults
: undefined;
return {
type: 'function',
executor: isClientTool ? 'client' : 'server',
...(parameterDefaults && Object.keys(parameterDefaults).length > 0 ? { defaultArgs: parameterDefaults } : {}),
function: {
name: toolId,
description: item?.description || item?.name || id,
parameters: getDefaultToolParameters(toolId),
parameters: parameterSchema,
},
};
});