Skip to content

Commit cd7747d

Browse files
waleedlatif1claude
andcommitted
fix(hubspot): align total fallback with type definitions in search tools
Use `?? 0` instead of `?? null` for search tools where the type declares `total: number`. Also declare `total` in list_lists metadata output schema. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0bcdc49 commit cd7747d

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

apps/sim/tools/hubspot/list_lists.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createLogger } from '@sim/logger'
22
import type { HubSpotListListsParams, HubSpotListListsResponse } from '@/tools/hubspot/types'
3-
import { LISTS_ARRAY_OUTPUT, METADATA_OUTPUT, PAGING_OUTPUT } from '@/tools/hubspot/types'
3+
import { LISTS_ARRAY_OUTPUT, METADATA_OUTPUT_PROPERTIES, PAGING_OUTPUT } from '@/tools/hubspot/types'
44
import type { ToolConfig } from '@/tools/types'
55

66
const logger = createLogger('HubSpotListLists')
@@ -94,7 +94,14 @@ export const hubspotListListsTool: ToolConfig<HubSpotListListsParams, HubSpotLis
9494
outputs: {
9595
lists: LISTS_ARRAY_OUTPUT,
9696
paging: PAGING_OUTPUT,
97-
metadata: METADATA_OUTPUT,
97+
metadata: {
98+
type: 'object',
99+
description: 'Response metadata',
100+
properties: {
101+
...METADATA_OUTPUT_PROPERTIES,
102+
total: { type: 'number', description: 'Total number of lists matching the query', optional: true },
103+
},
104+
},
98105
success: { type: 'boolean', description: 'Operation success status' },
99106
},
100107
}

apps/sim/tools/hubspot/search_companies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const hubspotSearchCompaniesTool: ToolConfig<
152152
success: true,
153153
output: {
154154
companies: data.results || [],
155-
total: data.total ?? null,
155+
total: data.total ?? 0,
156156
paging: data.paging ?? null,
157157
metadata: {
158158
totalReturned: data.results?.length || 0,

apps/sim/tools/hubspot/search_contacts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const hubspotSearchContactsTool: ToolConfig<
152152
success: true,
153153
output: {
154154
contacts: data.results || [],
155-
total: data.total ?? null,
155+
total: data.total ?? 0,
156156
paging: data.paging ?? null,
157157
metadata: {
158158
totalReturned: data.results?.length || 0,

apps/sim/tools/hubspot/search_deals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const hubspotSearchDealsTool: ToolConfig<
131131
success: true,
132132
output: {
133133
deals: data.results || [],
134-
total: data.total ?? null,
134+
total: data.total ?? 0,
135135
paging: data.paging ?? null,
136136
metadata: {
137137
totalReturned: data.results?.length || 0,

apps/sim/tools/hubspot/search_tickets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export const hubspotSearchTicketsTool: ToolConfig<
134134
success: true,
135135
output: {
136136
tickets: data.results || [],
137-
total: data.total ?? null,
137+
total: data.total ?? 0,
138138
paging: data.paging ?? null,
139139
metadata: {
140140
totalReturned: data.results?.length || 0,

0 commit comments

Comments
 (0)