Skip to content

Commit 451e122

Browse files
committed
fix(quartr): address review findings — null-safe query building, string boolean toggles, accurate descriptions, NestJS validation error extractor
1 parent 254be54 commit 451e122

16 files changed

Lines changed: 125 additions & 74 deletions

apps/docs/content/docs/en/integrations/quartr.mdx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ List companies covered by Quartr, filterable by ticker, ISIN, CIK, OpenFIGI, cou
5555
| `openfigis` | string | No | Comma-separated list of OpenFIGI codes \(figi, compositeFigi, or shareClassFigi\) |
5656
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
5757
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
58-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
58+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
5959
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
6060
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
6161

@@ -130,9 +130,9 @@ List corporate events (earnings calls, capital markets days, etc.) from Quartr,
130130
| `sortBy` | string | No | Field to sort by: "id" or "date" \(default: id\) |
131131
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
132132
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
133-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
133+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
134134
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
135-
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
135+
| `direction` | string | No | Sort direction applied to the sortBy field: "asc" or "desc" \(default: asc\) |
136136

137137
#### Output
138138

@@ -197,7 +197,7 @@ Retrieve the AI-generated summary of a corporate event from Quartr, with selecta
197197

198198
| Parameter | Type | Description |
199199
| --------- | ---- | ----------- |
200-
| `summary` | string | AI-generated event summary in Markdown |
200+
| `summary` | string | AI-generated event summary in Markdown \(includes embedded document source tags unless a plain-text summary is requested\) |
201201
| `sources` | array | Source documents referenced by the summary |
202202
|`sourceId` | string | ID linking the source document to tags embedded in the summary |
203203
|`documentId` | number | Quartr document ID of the source |
@@ -217,7 +217,7 @@ List the event types available in Quartr (e.g., earnings calls), useful for filt
217217
| Parameter | Type | Required | Description |
218218
| --------- | ---- | -------- | ----------- |
219219
| `apiKey` | string | Yes | Quartr API key |
220-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
220+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
221221
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
222222
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
223223

@@ -256,7 +256,7 @@ List documents of all kinds (reports, slide decks, and transcripts) from Quartr,
256256
| `expandEvent` | boolean | No | Include expanded event details on each document |
257257
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
258258
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
259-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
259+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
260260
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
261261
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
262262

@@ -290,7 +290,7 @@ List the document types available in Quartr (e.g., 10-Q quarterly reports), usef
290290
| Parameter | Type | Required | Description |
291291
| --------- | ---- | -------- | ----------- |
292292
| `apiKey` | string | Yes | Quartr API key |
293-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
293+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
294294
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
295295
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
296296

@@ -332,7 +332,7 @@ List filings and reports (10-K, 10-Q, earnings releases, etc.) from Quartr, filt
332332
| `expandEvent` | boolean | No | Include expanded event details on each document |
333333
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
334334
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
335-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
335+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
336336
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
337337
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
338338

@@ -413,7 +413,7 @@ List slide presentations from Quartr, filterable by company, event, document typ
413413
| `expandEvent` | boolean | No | Include expanded event details on each document |
414414
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
415415
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
416-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
416+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
417417
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
418418
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
419419

@@ -494,7 +494,7 @@ List event transcripts from Quartr, filterable by company, event, document type,
494494
| `expandEvent` | boolean | No | Include expanded event details on each document |
495495
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
496496
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
497-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
497+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
498498
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
499499
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
500500

@@ -573,7 +573,7 @@ List archived event audio recordings from Quartr, filterable by company, event,
573573
| `expandEvent` | boolean | No | Include expanded event details on each audio recording |
574574
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
575575
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
576-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
576+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
577577
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
578578
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
579579

@@ -657,13 +657,13 @@ List live and upcoming events from Quartr with live audio and transcript stream
657657
| `ciks` | string | No | Comma-separated list of SEC CIKs \(e.g., "0000320193"\) |
658658
| `countries` | string | No | Comma-separated list of ISO 3166-1 alpha-2 country codes \(e.g., "US,SE"\) |
659659
| `exchanges` | string | No | Comma-separated list of exchange symbols, without whitespace \(e.g., "NasdaqGS"\) |
660-
| `states` | string | No | Comma-separated list of live states to filter by: notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess |
660+
| `states` | string | No | Comma-separated list of live states to filter by: notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess, liveFailedNotStarted, processingRecording, processingRecordingFailed, recordingAvailable |
661661
| `startDate` | string | No | Only return events on or after this ISO 8601 date \(e.g., "2024-01-01"\) |
662662
| `endDate` | string | No | Only return events on or before this ISO 8601 date \(e.g., "2024-12-31"\) |
663663
| `transcriptVersion` | string | No | Version of the live transcript stream: "1.6" or "1.7" \(default: 1.6\) |
664664
| `updatedAfter` | string | No | Only return data updated after this ISO 8601 date \(e.g., "2024-01-01"\) |
665665
| `updatedBefore` | string | No | Only return data updated before this ISO 8601 date \(e.g., "2024-12-31"\) |
666-
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10\) |
666+
| `limit` | number | No | Maximum number of items to return in a single request \(default: 10, max: 500\) |
667667
| `cursor` | number | No | Pagination cursor from the previous response \(nextCursor\) for the next page |
668668
| `direction` | string | No | Sort direction by id: "asc" or "desc" \(default: asc\) |
669669

@@ -677,7 +677,7 @@ List live and upcoming events from Quartr with live audio and transcript stream
677677
|`companyId` | number | Quartr company ID |
678678
|`date` | string | Scheduled event date \(ISO 8601\) |
679679
|`wentLiveAt` | string | Timestamp when the event went live \(ISO 8601\) |
680-
|`state` | string | Live state \(notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess, recordingAvailable\) |
680+
|`state` | string | Live state \(notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess, liveFailedNotStarted, processingRecording, processingRecordingFailed, recordingAvailable\) |
681681
|`audio` | string | URL of the live audio stream or recording |
682682
|`transcript` | string | URL of the live transcript stream \(JSON Lines\) |
683683
|`createdAt` | string | Creation timestamp \(ISO 8601\) |

apps/sim/blocks/blocks/quartr.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const DATE_RANGE_LIST_OPERATIONS = [
4343
'list_live_events',
4444
]
4545

46+
const UPDATED_RANGE_LIST_OPERATIONS = ['list_companies', ...DATE_RANGE_LIST_OPERATIONS]
47+
4648
export const QuartrBlock: BlockConfig<ToolResponse> = {
4749
type: 'quartr',
4850
name: 'Quartr',
@@ -302,7 +304,7 @@ export const QuartrBlock: BlockConfig<ToolResponse> = {
302304
title: 'Updated After',
303305
type: 'short-input',
304306
placeholder: 'ISO 8601 date (e.g., 2024-01-01)',
305-
condition: { field: 'operation', value: ALL_LIST_OPERATIONS },
307+
condition: { field: 'operation', value: UPDATED_RANGE_LIST_OPERATIONS },
306308
mode: 'advanced',
307309
wandConfig: {
308310
enabled: true,
@@ -316,7 +318,7 @@ export const QuartrBlock: BlockConfig<ToolResponse> = {
316318
title: 'Updated Before',
317319
type: 'short-input',
318320
placeholder: 'ISO 8601 date (e.g., 2024-12-31)',
319-
condition: { field: 'operation', value: ALL_LIST_OPERATIONS },
321+
condition: { field: 'operation', value: UPDATED_RANGE_LIST_OPERATIONS },
320322
mode: 'advanced',
321323
wandConfig: {
322324
enabled: true,
@@ -443,7 +445,8 @@ export const QuartrBlock: BlockConfig<ToolResponse> = {
443445
},
444446
summary: {
445447
type: 'string',
446-
description: 'AI-generated event summary in Markdown',
448+
description:
449+
'AI-generated event summary in Markdown (includes embedded document source tags unless a plain-text summary is requested)',
447450
condition: { field: 'operation', value: 'get_event_summary' },
448451
},
449452
sources: {

apps/sim/tools/error-extractors.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,31 @@ const ERROR_EXTRACTORS: ErrorExtractorConfig[] = [
145145
return undefined
146146
},
147147
},
148+
{
149+
id: 'nestjs-validation-errors',
150+
description: 'NestJS validation errors with a message array of field/message objects',
151+
examples: ['Quartr API'],
152+
extract: (errorInfo) => {
153+
const message = errorInfo?.data?.message
154+
if (!Array.isArray(message) || message.length === 0) return undefined
155+
156+
const entries = message
157+
.map((entry) => {
158+
if (typeof entry === 'string') return entry
159+
if (entry && typeof entry === 'object' && typeof entry.message === 'string') {
160+
return typeof entry.field === 'string' && entry.field
161+
? `${entry.field}: ${entry.message}`
162+
: entry.message
163+
}
164+
return undefined
165+
})
166+
.filter((entry): entry is string => Boolean(entry))
167+
if (entries.length === 0) return undefined
168+
169+
const prefix = typeof errorInfo?.data?.error === 'string' ? `${errorInfo.data.error}: ` : ''
170+
return `${prefix}${entries.join('; ')}`
171+
},
172+
},
148173
{
149174
id: 'hunter-errors',
150175
description: 'Hunter API error details',
@@ -275,6 +300,7 @@ export const ErrorExtractorId = {
275300
DETAILS_ARRAY: 'details-array',
276301
DETAILS_STRING_ARRAY: 'details-string-array',
277302
BATCH_VALIDATION_ERRORS: 'batch-validation-errors',
303+
NESTJS_VALIDATION_ERRORS: 'nestjs-validation-errors',
278304
HUNTER_ERRORS: 'hunter-errors',
279305
ERRORS_ARRAY_STRING: 'errors-array-string',
280306
TELEGRAM_DESCRIPTION: 'telegram-description',

apps/sim/tools/quartr/get_event_summary.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import {
55
type QuartrSingleDto,
66
type QuartrSummaryDto,
77
} from '@/tools/quartr/types'
8-
import { buildQuartrUrl, mapQuartrSummarySource, parseQuartrResponse } from '@/tools/quartr/utils'
8+
import {
9+
buildQuartrUrl,
10+
isQuartrToggleEnabled,
11+
mapQuartrSummarySource,
12+
parseQuartrResponse,
13+
} from '@/tools/quartr/utils'
914
import type { ToolConfig } from '@/tools/types'
1015

1116
export const quartrGetEventSummaryTool: ToolConfig<
@@ -49,7 +54,7 @@ export const quartrGetEventSummaryTool: ToolConfig<
4954
url: (params) =>
5055
buildQuartrUrl(`/events/${encodeURIComponent(String(params.eventId).trim())}/summary`, {
5156
length: params.summaryLength,
52-
plain: params.plainSummary === true ? true : undefined,
57+
plain: isQuartrToggleEnabled(params.plainSummary) ? true : undefined,
5358
}),
5459
method: 'GET',
5560
headers: (params) => ({ 'x-api-key': params.apiKey }),
@@ -77,7 +82,8 @@ export const quartrGetEventSummaryTool: ToolConfig<
7782
outputs: {
7883
summary: {
7984
type: 'string',
80-
description: 'AI-generated event summary in Markdown',
85+
description:
86+
'AI-generated event summary in Markdown (includes embedded document source tags unless a plain-text summary is requested)',
8187
},
8288
sources: {
8389
type: 'array',

apps/sim/tools/quartr/list_audio.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import {
88
import {
99
buildQuartrListQuery,
1010
buildQuartrUrl,
11+
isQuartrToggleEnabled,
1112
mapQuartrAudio,
12-
normalizeQuartrIdList,
13+
normalizeQuartrCommaList,
1314
parseQuartrResponse,
1415
} from '@/tools/quartr/utils'
1516
import type { ToolConfig } from '@/tools/types'
@@ -105,7 +106,7 @@ export const quartrListAudioTool: ToolConfig<QuartrListAudioParams, QuartrListAu
105106
type: 'number',
106107
required: false,
107108
visibility: 'user-or-llm',
108-
description: 'Maximum number of items to return in a single request (default: 10)',
109+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
109110
},
110111
cursor: {
111112
type: 'number',
@@ -125,11 +126,11 @@ export const quartrListAudioTool: ToolConfig<QuartrListAudioParams, QuartrListAu
125126
url: (params) =>
126127
buildQuartrUrl('/audio', {
127128
...buildQuartrListQuery(params),
128-
companyIds: normalizeQuartrIdList(params.companyIds),
129-
eventIds: normalizeQuartrIdList(params.eventIds),
129+
companyIds: normalizeQuartrCommaList(params.companyIds),
130+
eventIds: normalizeQuartrCommaList(params.eventIds),
130131
startDate: params.startDate,
131132
endDate: params.endDate,
132-
expand: params.expandEvent === true ? 'event' : undefined,
133+
expand: isQuartrToggleEnabled(params.expandEvent) ? 'event' : undefined,
133134
}),
134135
method: 'GET',
135136
headers: (params) => ({ 'x-api-key': params.apiKey }),

apps/sim/tools/quartr/list_companies.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
buildQuartrListQuery,
1010
buildQuartrUrl,
1111
mapQuartrCompany,
12-
normalizeQuartrIdList,
12+
normalizeQuartrCommaList,
1313
parseQuartrResponse,
1414
} from '@/tools/quartr/utils'
1515
import type { ToolConfig } from '@/tools/types'
@@ -91,7 +91,7 @@ export const quartrListCompaniesTool: ToolConfig<
9191
type: 'number',
9292
required: false,
9393
visibility: 'user-or-llm',
94-
description: 'Maximum number of items to return in a single request (default: 10)',
94+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
9595
},
9696
cursor: {
9797
type: 'number',
@@ -111,8 +111,8 @@ export const quartrListCompaniesTool: ToolConfig<
111111
url: (params) =>
112112
buildQuartrUrl('/companies', {
113113
...buildQuartrListQuery(params),
114-
ids: normalizeQuartrIdList(params.companyIds),
115-
openfigis: normalizeQuartrIdList(params.openfigis),
114+
ids: normalizeQuartrCommaList(params.companyIds),
115+
openfigis: normalizeQuartrCommaList(params.openfigis),
116116
}),
117117
method: 'GET',
118118
headers: (params) => ({ 'x-api-key': params.apiKey }),

apps/sim/tools/quartr/list_document_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const quartrListDocumentTypesTool: ToolConfig<
2929
type: 'number',
3030
required: false,
3131
visibility: 'user-or-llm',
32-
description: 'Maximum number of items to return in a single request (default: 10)',
32+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
3333
},
3434
cursor: {
3535
type: 'number',

apps/sim/tools/quartr/list_documents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const quartrListDocumentsTool: ToolConfig<
122122
type: 'number',
123123
required: false,
124124
visibility: 'user-or-llm',
125-
description: 'Maximum number of items to return in a single request (default: 10)',
125+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
126126
},
127127
cursor: {
128128
type: 'number',

apps/sim/tools/quartr/list_event_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const quartrListEventTypesTool: ToolConfig<
2929
type: 'number',
3030
required: false,
3131
visibility: 'user-or-llm',
32-
description: 'Maximum number of items to return in a single request (default: 10)',
32+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
3333
},
3434
cursor: {
3535
type: 'number',

apps/sim/tools/quartr/list_events.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
buildQuartrListQuery,
1010
buildQuartrUrl,
1111
mapQuartrEvent,
12-
normalizeQuartrIdList,
12+
normalizeQuartrCommaList,
1313
parseQuartrResponse,
1414
} from '@/tools/quartr/utils'
1515
import type { ToolConfig } from '@/tools/types'
@@ -105,7 +105,7 @@ export const quartrListEventsTool: ToolConfig<QuartrListEventsParams, QuartrList
105105
type: 'number',
106106
required: false,
107107
visibility: 'user-or-llm',
108-
description: 'Maximum number of items to return in a single request (default: 10)',
108+
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
109109
},
110110
cursor: {
111111
type: 'number',
@@ -117,16 +117,16 @@ export const quartrListEventsTool: ToolConfig<QuartrListEventsParams, QuartrList
117117
type: 'string',
118118
required: false,
119119
visibility: 'user-only',
120-
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
120+
description: 'Sort direction applied to the sortBy field: "asc" or "desc" (default: asc)',
121121
},
122122
},
123123

124124
request: {
125125
url: (params) =>
126126
buildQuartrUrl('/events', {
127127
...buildQuartrListQuery(params),
128-
companyIds: normalizeQuartrIdList(params.companyIds),
129-
typeIds: normalizeQuartrIdList(params.eventTypeIds),
128+
companyIds: normalizeQuartrCommaList(params.companyIds),
129+
typeIds: normalizeQuartrCommaList(params.eventTypeIds),
130130
startDate: params.startDate,
131131
endDate: params.endDate,
132132
sortBy: params.sortBy,

0 commit comments

Comments
 (0)