File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,18 @@ export async function getNormalActorsAsTools(
123123 if ( actorDefinitionPruned ) {
124124 const schemaID = getToolSchemaID ( actorDefinitionPruned . actorFullName ) ;
125125 if ( actorDefinitionPruned . input && 'properties' in actorDefinitionPruned . input && actorDefinitionPruned . input ) {
126+ // Filter non-required properties if `required` is defined in the input schema and not empty
127+ const { required } = actorDefinitionPruned . input ;
128+ if ( Array . isArray ( required ) && required . length > 0 ) {
129+ actorDefinitionPruned . input . properties = Object . fromEntries (
130+ Object . entries ( actorDefinitionPruned . input . properties )
131+ // Keep all integer properties, as these include
132+ // properties related to output item counts that the user
133+ // might want to change if more results are needed than the default limit.
134+ . filter ( ( [ key , value ] ) => required . includes ( key ) || value . type === 'integer' ) ,
135+ ) ;
136+ }
137+
126138 actorDefinitionPruned . input . properties = markInputPropertiesAsRequired ( actorDefinitionPruned . input ) ;
127139 actorDefinitionPruned . input . properties = buildNestedProperties ( actorDefinitionPruned . input . properties ) ;
128140 actorDefinitionPruned . input . properties = filterSchemaProperties ( actorDefinitionPruned . input . properties ) ;
You can’t perform that action at this time.
0 commit comments