@@ -4,23 +4,9 @@ import {
44 type ProspeoSearchPersonParams ,
55 type ProspeoSearchPersonResponse ,
66} from '@/tools/prospeo/types'
7+ import { parseFiltersObject } from '@/tools/prospeo/utils'
78import type { ToolConfig } from '@/tools/types'
89
9- function parseFilters ( value : unknown ) : Record < string , unknown > {
10- if ( value && typeof value === 'object' && ! Array . isArray ( value ) ) {
11- return value as Record < string , unknown >
12- }
13- if ( typeof value === 'string' && value . trim ( ) . length > 0 ) {
14- try {
15- const parsed = JSON . parse ( value )
16- if ( parsed && typeof parsed === 'object' && ! Array . isArray ( parsed ) ) {
17- return parsed as Record < string , unknown >
18- }
19- } catch { }
20- }
21- return { }
22- }
23-
2410export const searchPersonTool : ToolConfig < ProspeoSearchPersonParams , ProspeoSearchPersonResponse > =
2511 {
2612 id : 'prospeo_search_person' ,
@@ -58,7 +44,7 @@ export const searchPersonTool: ToolConfig<ProspeoSearchPersonParams, ProspeoSear
5844 'Content-Type' : 'application/json' ,
5945 } ) ,
6046 body : ( params ) => {
61- const body : Record < string , unknown > = { filters : parseFilters ( params . filters ) }
47+ const body : Record < string , unknown > = { filters : parseFiltersObject ( params . filters ) }
6248 if ( params . page !== undefined ) body . page = params . page
6349 return body
6450 } ,
0 commit comments