* 清理参数(移除未定义的参数)
(
parameters: Record<string, any>,
schema: Record<string, ToolParameterSchema>
)
| 115 | * 清理参数(移除未定义的参数) |
| 116 | */ |
| 117 | public static sanitizeParameters( |
| 118 | parameters: Record<string, any>, |
| 119 | schema: Record<string, ToolParameterSchema> |
| 120 | ): Record<string, any> { |
| 121 | const result: Record<string, any> = {}; |
| 122 | |
| 123 | for (const [key, value] of Object.entries(parameters)) { |
| 124 | if (key in schema && value !== undefined) { |
| 125 | result[key] = value; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | return result; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * 生成参数文档 |