Fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
754c97956f
commit
2846e179a3
2 changed files with 8 additions and 5 deletions
|
|
@ -779,8 +779,8 @@ const App = () => {
|
|||
|
||||
try {
|
||||
// Find the tool schema to clean parameters properly
|
||||
const tool = tools.find(t => t.name === name);
|
||||
const cleanedParams = tool?.inputSchema
|
||||
const tool = tools.find((t) => t.name === name);
|
||||
const cleanedParams = tool?.inputSchema
|
||||
? cleanParams(params, tool.inputSchema as any)
|
||||
: params;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@ import type { JsonSchemaType } from "./jsonUtils";
|
|||
/**
|
||||
* Cleans parameters by removing undefined, null, and empty string values for optional fields
|
||||
* while preserving all values for required fields.
|
||||
*
|
||||
*
|
||||
* @param params - The parameters object to clean
|
||||
* @param schema - The JSON schema defining which fields are required
|
||||
* @returns Cleaned parameters object with optional empty fields omitted
|
||||
*/
|
||||
export function cleanParams(
|
||||
params: Record<string, unknown>,
|
||||
schema: JsonSchemaType
|
||||
schema: JsonSchemaType,
|
||||
): Record<string, unknown> {
|
||||
const cleaned: Record<string, unknown> = {};
|
||||
const required = schema.required || [];
|
||||
|
|
@ -39,6 +39,9 @@ export function cleanParams(
|
|||
* @param value - The current value
|
||||
* @returns Whether to set the field to undefined
|
||||
*/
|
||||
export function shouldSetToUndefined(isRequired: boolean, value: string): boolean {
|
||||
export function shouldSetToUndefined(
|
||||
isRequired: boolean,
|
||||
value: string,
|
||||
): boolean {
|
||||
return !isRequired && value === "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue