chore: import upstream snapshot with attribution
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
import {
QUARTR_AUDIO_OUTPUT_PROPERTIES,
type QuartrAudioDto,
type QuartrGetAudioParams,
type QuartrGetAudioResponse,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrAudio, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetAudioTool: ToolConfig<QuartrGetAudioParams, QuartrGetAudioResponse> = {
id: 'quartr_get_audio',
name: 'Quartr Get Audio',
description:
'Retrieve an archived event audio recording from Quartr by its audio ID. Returns download (MPEG) and streaming (M3U8) URLs.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
audioId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr audio ID (e.g., 123964)',
},
},
request: {
url: (params) =>
buildQuartrUrl(`/audio/${encodeURIComponent(String(params.audioId).trim())}`, {
expand: 'event',
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrAudioDto>>(response, 'get audio')
return {
success: true,
output: {
audio: mapQuartrAudio(data.data),
},
}
},
outputs: {
audio: {
type: 'object',
description: 'The requested audio recording',
properties: QUARTR_AUDIO_OUTPUT_PROPERTIES,
},
},
}
+60
View File
@@ -0,0 +1,60 @@
import {
QUARTR_COMPANY_OUTPUT_PROPERTIES,
type QuartrCompanyDto,
type QuartrGetCompanyParams,
type QuartrGetCompanyResponse,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrCompany, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetCompanyTool: ToolConfig<QuartrGetCompanyParams, QuartrGetCompanyResponse> = {
id: 'quartr_get_company',
name: 'Quartr Get Company',
description: 'Retrieve a single company from Quartr by its company ID.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr company ID (e.g., 4742)',
},
},
request: {
url: (params) =>
buildQuartrUrl(`/companies/${encodeURIComponent(String(params.companyId).trim())}`),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrCompanyDto>>(
response,
'get company'
)
return {
success: true,
output: {
company: mapQuartrCompany(data.data),
},
}
},
outputs: {
company: {
type: 'object',
description: 'The requested company',
properties: QUARTR_COMPANY_OUTPUT_PROPERTIES,
},
},
}
+56
View File
@@ -0,0 +1,56 @@
import {
QUARTR_EVENT_OUTPUT_PROPERTIES,
type QuartrEventDto,
type QuartrGetEventParams,
type QuartrGetEventResponse,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrEvent, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetEventTool: ToolConfig<QuartrGetEventParams, QuartrGetEventResponse> = {
id: 'quartr_get_event',
name: 'Quartr Get Event',
description: 'Retrieve a single corporate event from Quartr by its event ID.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
eventId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr event ID (e.g., 128301)',
},
},
request: {
url: (params) => buildQuartrUrl(`/events/${encodeURIComponent(String(params.eventId).trim())}`),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrEventDto>>(response, 'get event')
return {
success: true,
output: {
event: mapQuartrEvent(data.data),
},
}
},
outputs: {
event: {
type: 'object',
description: 'The requested event',
properties: QUARTR_EVENT_OUTPUT_PROPERTIES,
},
},
}
+103
View File
@@ -0,0 +1,103 @@
import {
QUARTR_SUMMARY_SOURCE_OUTPUT_PROPERTIES,
type QuartrGetEventSummaryParams,
type QuartrGetEventSummaryResponse,
type QuartrSingleDto,
type QuartrSummaryDto,
} from '@/tools/quartr/types'
import {
buildQuartrUrl,
isQuartrToggleEnabled,
mapQuartrSummarySource,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetEventSummaryTool: ToolConfig<
QuartrGetEventSummaryParams,
QuartrGetEventSummaryResponse
> = {
id: 'quartr_get_event_summary',
name: 'Quartr Get Event Summary',
description:
'Retrieve the AI-generated summary of a corporate event from Quartr, with selectable length and optional plain-text formatting.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
eventId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr event ID (e.g., 128301)',
},
summaryLength: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Length preset for the summary: "line", "short", or "long" (default: short)',
},
plainSummary: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Return a plain-text summary without embedded document source tags',
},
},
request: {
url: (params) =>
buildQuartrUrl(`/events/${encodeURIComponent(String(params.eventId).trim())}/summary`, {
length: params.summaryLength,
plain: isQuartrToggleEnabled(params.plainSummary) ? true : undefined,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrSummaryDto>>(
response,
'get event summary'
)
const summary = data.data
return {
success: true,
output: {
summary: summary.summary,
sources: (summary.sources ?? []).map(mapQuartrSummarySource),
summaryId: summary.id,
summaryCreatedAt: summary.createdAt,
summaryUpdatedAt: summary.updatedAt,
},
}
},
outputs: {
summary: {
type: 'string',
description:
'AI-generated event summary in Markdown (includes embedded document source tags unless a plain-text summary is requested)',
},
sources: {
type: 'array',
description: 'Source documents referenced by the summary',
items: { type: 'object', properties: QUARTR_SUMMARY_SOURCE_OUTPUT_PROPERTIES },
},
summaryId: { type: 'number', description: 'Quartr summary ID' },
summaryCreatedAt: {
type: 'string',
description: 'Summary creation timestamp (ISO 8601)',
},
summaryUpdatedAt: {
type: 'string',
description: 'Summary last update timestamp (ISO 8601)',
},
},
}
+77
View File
@@ -0,0 +1,77 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrGetDocumentFileResponse,
type QuartrGetReportParams,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrDocument, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetReportTool: ToolConfig<QuartrGetReportParams, QuartrGetDocumentFileResponse> =
{
id: 'quartr_get_report',
name: 'Quartr Get Report',
description:
'Retrieve a filing or report (10-K, 10-Q, earnings release, etc.) from Quartr by its document ID and download the PDF file.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
reportId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr document ID of the report (e.g., 432907)',
},
},
request: {
url: (params) =>
buildQuartrUrl(`/documents/reports/${encodeURIComponent(String(params.reportId).trim())}`, {
expand: 'event',
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrDocumentDto>>(
response,
'get report'
)
const document = mapQuartrDocument(data.data)
return {
success: true,
output: {
document,
fileUrl: document.fileUrl,
file: {
name: `quartr-report-${document.id}.pdf`,
mimeType: 'application/pdf',
url: document.fileUrl,
},
},
}
},
outputs: {
document: {
type: 'object',
description: 'Report metadata',
properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
},
fileUrl: { type: 'string', description: 'URL of the report PDF' },
file: {
type: 'file',
description: 'Downloaded report PDF stored in execution files',
fileConfig: { mimeType: 'application/pdf', extension: 'pdf' },
},
},
}
+79
View File
@@ -0,0 +1,79 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrGetDocumentFileResponse,
type QuartrGetSlideDeckParams,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrDocument, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetSlideDeckTool: ToolConfig<
QuartrGetSlideDeckParams,
QuartrGetDocumentFileResponse
> = {
id: 'quartr_get_slide_deck',
name: 'Quartr Get Slide Deck',
description:
'Retrieve a slide presentation from Quartr by its document ID and download the PDF file.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
slideDeckId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr document ID of the slide deck (e.g., 432907)',
},
},
request: {
url: (params) =>
buildQuartrUrl(`/documents/slides/${encodeURIComponent(String(params.slideDeckId).trim())}`, {
expand: 'event',
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrDocumentDto>>(
response,
'get slide deck'
)
const document = mapQuartrDocument(data.data)
return {
success: true,
output: {
document,
fileUrl: document.fileUrl,
file: {
name: `quartr-slide-deck-${document.id}.pdf`,
mimeType: 'application/pdf',
url: document.fileUrl,
},
},
}
},
outputs: {
document: {
type: 'object',
description: 'Slide deck metadata',
properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
},
fileUrl: { type: 'string', description: 'URL of the slide deck PDF' },
file: {
type: 'file',
description: 'Downloaded slide deck PDF stored in execution files',
fileConfig: { mimeType: 'application/pdf', extension: 'pdf' },
},
},
}
+80
View File
@@ -0,0 +1,80 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrGetDocumentFileResponse,
type QuartrGetTranscriptParams,
type QuartrSingleDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrDocument, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrGetTranscriptTool: ToolConfig<
QuartrGetTranscriptParams,
QuartrGetDocumentFileResponse
> = {
id: 'quartr_get_transcript',
name: 'Quartr Get Transcript',
description:
'Retrieve an event transcript from Quartr by its document ID and download the transcript JSON file (paragraphs, sentences, timestamps, and speaker identification).',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
transcriptId: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Quartr document ID of the transcript (e.g., 432907)',
},
},
request: {
url: (params) =>
buildQuartrUrl(
`/documents/transcripts/${encodeURIComponent(String(params.transcriptId).trim())}`,
{ expand: 'event' }
),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrSingleDto<QuartrDocumentDto>>(
response,
'get transcript'
)
const document = mapQuartrDocument(data.data)
return {
success: true,
output: {
document,
fileUrl: document.fileUrl,
file: {
name: `quartr-transcript-${document.id}.json`,
mimeType: 'application/json',
url: document.fileUrl,
},
},
}
},
outputs: {
document: {
type: 'object',
description: 'Transcript metadata',
properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
},
fileUrl: { type: 'string', description: 'URL of the transcript JSON file' },
file: {
type: 'file',
description: 'Downloaded transcript JSON file stored in execution files',
fileConfig: { mimeType: 'application/json', extension: 'json' },
},
},
}
+17
View File
@@ -0,0 +1,17 @@
export { quartrGetAudioTool } from '@/tools/quartr/get_audio'
export { quartrGetCompanyTool } from '@/tools/quartr/get_company'
export { quartrGetEventTool } from '@/tools/quartr/get_event'
export { quartrGetEventSummaryTool } from '@/tools/quartr/get_event_summary'
export { quartrGetReportTool } from '@/tools/quartr/get_report'
export { quartrGetSlideDeckTool } from '@/tools/quartr/get_slide_deck'
export { quartrGetTranscriptTool } from '@/tools/quartr/get_transcript'
export { quartrListAudioTool } from '@/tools/quartr/list_audio'
export { quartrListCompaniesTool } from '@/tools/quartr/list_companies'
export { quartrListDocumentTypesTool } from '@/tools/quartr/list_document_types'
export { quartrListDocumentsTool } from '@/tools/quartr/list_documents'
export { quartrListEventTypesTool } from '@/tools/quartr/list_event_types'
export { quartrListEventsTool } from '@/tools/quartr/list_events'
export { quartrListLiveEventsTool } from '@/tools/quartr/list_live_events'
export { quartrListReportsTool } from '@/tools/quartr/list_reports'
export { quartrListSlideDecksTool } from '@/tools/quartr/list_slide_decks'
export { quartrListTranscriptsTool } from '@/tools/quartr/list_transcripts'
+166
View File
@@ -0,0 +1,166 @@
import {
QUARTR_AUDIO_OUTPUT_PROPERTIES,
type QuartrAudioDto,
type QuartrListAudioParams,
type QuartrListAudioResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrListQuery,
buildQuartrUrl,
isQuartrToggleEnabled,
mapQuartrAudio,
normalizeQuartrCommaList,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListAudioTool: ToolConfig<QuartrListAudioParams, QuartrListAudioResponse> = {
id: 'quartr_list_audio',
name: 'Quartr List Audio',
description:
'List archived event audio recordings from Quartr, filterable by company, event, and date range. Returns download (MPEG) and streaming (M3U8) URLs.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return audio dated on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return audio dated on or before this ISO 8601 date (e.g., "2024-12-31")',
},
expandEvent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Include expanded event details on each audio recording',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/audio', {
...buildQuartrListQuery(params),
companyIds: normalizeQuartrCommaList(params.companyIds),
eventIds: normalizeQuartrCommaList(params.eventIds),
startDate: params.startDate,
endDate: params.endDate,
expand: isQuartrToggleEnabled(params.expandEvent) ? 'event' : undefined,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrAudioDto>>(
response,
'list audio'
)
return {
success: true,
output: {
audioRecordings: (data.data ?? []).map(mapQuartrAudio),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
audioRecordings: {
type: 'array',
description: 'Audio recordings matching the filters',
items: { type: 'object', properties: QUARTR_AUDIO_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+148
View File
@@ -0,0 +1,148 @@
import {
QUARTR_COMPANY_OUTPUT_PROPERTIES,
type QuartrCompanyDto,
type QuartrListCompaniesParams,
type QuartrListCompaniesResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrListQuery,
buildQuartrUrl,
mapQuartrCompany,
normalizeQuartrCommaList,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListCompaniesTool: ToolConfig<
QuartrListCompaniesParams,
QuartrListCompaniesResponse
> = {
id: 'quartr_list_companies',
name: 'Quartr List Companies',
description:
'List companies covered by Quartr, filterable by ticker, ISIN, CIK, OpenFIGI, country, and exchange.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
openfigis: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of OpenFIGI codes (figi, compositeFigi, or shareClassFigi)',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/companies', {
...buildQuartrListQuery(params),
ids: normalizeQuartrCommaList(params.companyIds),
openfigis: normalizeQuartrCommaList(params.openfigis),
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrCompanyDto>>(
response,
'list companies'
)
return {
success: true,
output: {
companies: (data.data ?? []).map(mapQuartrCompany),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
companies: {
type: 'array',
description: 'Companies matching the filters',
items: { type: 'object', properties: QUARTR_COMPANY_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
@@ -0,0 +1,86 @@
import {
QUARTR_DOCUMENT_TYPE_OUTPUT_PROPERTIES,
type QuartrDocumentTypeDto,
type QuartrListDocumentTypesParams,
type QuartrListDocumentTypesResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrDocumentType, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListDocumentTypesTool: ToolConfig<
QuartrListDocumentTypesParams,
QuartrListDocumentTypesResponse
> = {
id: 'quartr_list_document_types',
name: 'Quartr List Document Types',
description:
'List the document types available in Quartr (e.g., 10-Q quarterly reports), useful for filtering documents by type ID.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/document-types', {
limit: params.limit,
cursor: params.cursor,
direction: params.direction,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrDocumentTypeDto>>(
response,
'list document types'
)
return {
success: true,
output: {
documentTypes: (data.data ?? []).map(mapQuartrDocumentType),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
documentTypes: {
type: 'array',
description: 'Available document types',
items: { type: 'object', properties: QUARTR_DOCUMENT_TYPE_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+174
View File
@@ -0,0 +1,174 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrListDocumentsParams,
type QuartrListDocumentsResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrDocumentListQuery,
buildQuartrUrl,
mapQuartrDocument,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListDocumentsTool: ToolConfig<
QuartrListDocumentsParams,
QuartrListDocumentsResponse
> = {
id: 'quartr_list_documents',
name: 'Quartr List Documents',
description:
'List documents of all kinds (reports, slide decks, and transcripts) from Quartr, filterable by company, event, document type, document group, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
documentTypeIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of document type IDs (e.g., "7,10")',
},
documentGroupIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of document group IDs: 1 = Earnings Release, 2 = Press Release, 3 = Interim Report, 4 = Annual Report, 5 = Proxy Statement, 6 = Registration Statement',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or before this ISO 8601 date (e.g., "2024-12-31")',
},
expandEvent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Include expanded event details on each document',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) => buildQuartrUrl('/documents', buildQuartrDocumentListQuery(params)),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrDocumentDto>>(
response,
'list documents'
)
return {
success: true,
output: {
documents: (data.data ?? []).map(mapQuartrDocument),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
documents: {
type: 'array',
description: 'Documents matching the filters',
items: { type: 'object', properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+86
View File
@@ -0,0 +1,86 @@
import {
QUARTR_EVENT_TYPE_OUTPUT_PROPERTIES,
type QuartrEventTypeDto,
type QuartrListEventTypesParams,
type QuartrListEventTypesResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import { buildQuartrUrl, mapQuartrEventType, parseQuartrResponse } from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListEventTypesTool: ToolConfig<
QuartrListEventTypesParams,
QuartrListEventTypesResponse
> = {
id: 'quartr_list_event_types',
name: 'Quartr List Event Types',
description:
'List the event types available in Quartr (e.g., earnings calls), useful for filtering events by type ID.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/event-types', {
limit: params.limit,
cursor: params.cursor,
direction: params.direction,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrEventTypeDto>>(
response,
'list event types'
)
return {
success: true,
output: {
eventTypes: (data.data ?? []).map(mapQuartrEventType),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
eventTypes: {
type: 'array',
description: 'Available event types',
items: { type: 'object', properties: QUARTR_EVENT_TYPE_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+165
View File
@@ -0,0 +1,165 @@
import {
QUARTR_EVENT_OUTPUT_PROPERTIES,
type QuartrEventDto,
type QuartrListEventsParams,
type QuartrListEventsResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrListQuery,
buildQuartrUrl,
mapQuartrEvent,
normalizeQuartrCommaList,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListEventsTool: ToolConfig<QuartrListEventsParams, QuartrListEventsResponse> = {
id: 'quartr_list_events',
name: 'Quartr List Events',
description:
'List corporate events (earnings calls, capital markets days, etc.) from Quartr, filterable by company, event type, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
eventTypeIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of event type IDs (e.g., "26,27")',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return events on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return events on or before this ISO 8601 date (e.g., "2024-12-31")',
},
sortBy: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Field to sort by: "id" or "date" (default: id)',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction applied to the sortBy field: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/events', {
...buildQuartrListQuery(params),
companyIds: normalizeQuartrCommaList(params.companyIds),
typeIds: normalizeQuartrCommaList(params.eventTypeIds),
startDate: params.startDate,
endDate: params.endDate,
sortBy: params.sortBy,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrEventDto>>(
response,
'list events'
)
return {
success: true,
output: {
events: (data.data ?? []).map(mapQuartrEvent),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
events: {
type: 'array',
description: 'Events matching the filters',
items: { type: 'object', properties: QUARTR_EVENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+176
View File
@@ -0,0 +1,176 @@
import {
QUARTR_LIVE_EVENT_OUTPUT_PROPERTIES,
type QuartrListLiveEventsParams,
type QuartrListLiveEventsResponse,
type QuartrLiveEventDto,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrListQuery,
buildQuartrUrl,
mapQuartrLiveEvent,
normalizeQuartrCommaList,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListLiveEventsTool: ToolConfig<
QuartrListLiveEventsParams,
QuartrListLiveEventsResponse
> = {
id: 'quartr_list_live_events',
name: 'Quartr List Live Events',
description:
'List live and upcoming events from Quartr with live audio and transcript stream URLs, filterable by company, live state, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
states: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of live states to filter by: notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess, liveFailedNotStarted, processingRecording, processingRecordingFailed, recordingAvailable',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return events on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Only return events on or before this ISO 8601 date (e.g., "2024-12-31")',
},
transcriptVersion: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Version of the live transcript stream: "1.6" or "1.7" (default: 1.6)',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) =>
buildQuartrUrl('/live', {
...buildQuartrListQuery(params),
companyIds: normalizeQuartrCommaList(params.companyIds),
eventIds: normalizeQuartrCommaList(params.eventIds),
states: normalizeQuartrCommaList(params.states),
startDate: params.startDate,
endDate: params.endDate,
transcriptVersion: params.transcriptVersion,
}),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrLiveEventDto>>(
response,
'list live events'
)
return {
success: true,
output: {
liveEvents: (data.data ?? []).map(mapQuartrLiveEvent),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
liveEvents: {
type: 'array',
description: 'Live events matching the filters',
items: { type: 'object', properties: QUARTR_LIVE_EVENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+174
View File
@@ -0,0 +1,174 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrListDocumentsParams,
type QuartrListReportsResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrDocumentListQuery,
buildQuartrUrl,
mapQuartrDocument,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListReportsTool: ToolConfig<
QuartrListDocumentsParams,
QuartrListReportsResponse
> = {
id: 'quartr_list_reports',
name: 'Quartr List Reports',
description:
'List filings and reports (10-K, 10-Q, earnings releases, etc.) from Quartr, filterable by company, event, document type, document group, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
documentTypeIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of document type IDs (e.g., "7,10")',
},
documentGroupIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of document group IDs: 1 = Earnings Release, 2 = Press Release, 3 = Interim Report, 4 = Annual Report, 5 = Proxy Statement, 6 = Registration Statement',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or before this ISO 8601 date (e.g., "2024-12-31")',
},
expandEvent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Include expanded event details on each document',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) => buildQuartrUrl('/documents/reports', buildQuartrDocumentListQuery(params)),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrDocumentDto>>(
response,
'list reports'
)
return {
success: true,
output: {
reports: (data.data ?? []).map(mapQuartrDocument),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
reports: {
type: 'array',
description: 'Reports matching the filters',
items: { type: 'object', properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+174
View File
@@ -0,0 +1,174 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrListDocumentsParams,
type QuartrListSlideDecksResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrDocumentListQuery,
buildQuartrUrl,
mapQuartrDocument,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListSlideDecksTool: ToolConfig<
QuartrListDocumentsParams,
QuartrListSlideDecksResponse
> = {
id: 'quartr_list_slide_decks',
name: 'Quartr List Slide Decks',
description:
'List slide presentations from Quartr, filterable by company, event, document type, document group, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
documentTypeIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of document type IDs (e.g., "7,10")',
},
documentGroupIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of document group IDs: 1 = Earnings Release, 2 = Press Release, 3 = Interim Report, 4 = Annual Report, 5 = Proxy Statement, 6 = Registration Statement',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or before this ISO 8601 date (e.g., "2024-12-31")',
},
expandEvent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Include expanded event details on each document',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) => buildQuartrUrl('/documents/slides', buildQuartrDocumentListQuery(params)),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrDocumentDto>>(
response,
'list slide decks'
)
return {
success: true,
output: {
slideDecks: (data.data ?? []).map(mapQuartrDocument),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
slideDecks: {
type: 'array',
description: 'Slide decks matching the filters',
items: { type: 'object', properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+174
View File
@@ -0,0 +1,174 @@
import {
QUARTR_DOCUMENT_OUTPUT_PROPERTIES,
type QuartrDocumentDto,
type QuartrListDocumentsParams,
type QuartrListTranscriptsResponse,
type QuartrPaginatedDto,
} from '@/tools/quartr/types'
import {
buildQuartrDocumentListQuery,
buildQuartrUrl,
mapQuartrDocument,
parseQuartrResponse,
} from '@/tools/quartr/utils'
import type { ToolConfig } from '@/tools/types'
export const quartrListTranscriptsTool: ToolConfig<
QuartrListDocumentsParams,
QuartrListTranscriptsResponse
> = {
id: 'quartr_list_transcripts',
name: 'Quartr List Transcripts',
description:
'List event transcripts from Quartr, filterable by company, event, document type, document group, and date range.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Quartr API key',
},
companyIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr company IDs (e.g., "4742,128")',
},
eventIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of Quartr event IDs (e.g., "128301")',
},
tickers: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of company tickers (e.g., "AAPL,MSFT")',
},
isins: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISINs (e.g., "US0378331005")',
},
ciks: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of SEC CIKs (e.g., "0000320193")',
},
countries: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of ISO 3166-1 alpha-2 country codes (e.g., "US,SE")',
},
exchanges: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of exchange symbols, without whitespace (e.g., "NasdaqGS")',
},
documentTypeIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of document type IDs (e.g., "7,10")',
},
documentGroupIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Comma-separated list of document group IDs: 1 = Earnings Release, 2 = Press Release, 3 = Interim Report, 4 = Annual Report, 5 = Proxy Statement, 6 = Registration Statement',
},
startDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or after this ISO 8601 date (e.g., "2024-01-01")',
},
endDate: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description:
'Only return documents dated on or before this ISO 8601 date (e.g., "2024-12-31")',
},
expandEvent: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Include expanded event details on each document',
},
updatedAfter: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated after this ISO 8601 date (e.g., "2024-01-01")',
},
updatedBefore: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Only return data updated before this ISO 8601 date (e.g., "2024-12-31")',
},
limit: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of items to return in a single request (default: 10, max: 500)',
},
cursor: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from the previous response (nextCursor) for the next page',
},
direction: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Sort direction by id: "asc" or "desc" (default: asc)',
},
},
request: {
url: (params) => buildQuartrUrl('/documents/transcripts', buildQuartrDocumentListQuery(params)),
method: 'GET',
headers: (params) => ({ 'x-api-key': params.apiKey }),
},
transformResponse: async (response) => {
const data = await parseQuartrResponse<QuartrPaginatedDto<QuartrDocumentDto>>(
response,
'list transcripts'
)
return {
success: true,
output: {
transcripts: (data.data ?? []).map(mapQuartrDocument),
nextCursor: data.pagination?.nextCursor ?? null,
},
}
},
outputs: {
transcripts: {
type: 'array',
description: 'Transcripts matching the filters',
items: { type: 'object', properties: QUARTR_DOCUMENT_OUTPUT_PROPERTIES },
},
nextCursor: {
type: 'number',
description: 'Cursor for fetching the next page of results (null when no more pages)',
optional: true,
},
},
}
+675
View File
@@ -0,0 +1,675 @@
import type { OutputProperty, ToolFileData, ToolResponse } from '@/tools/types'
/** Raw ticker entry as returned by the Quartr API. */
export interface QuartrTicker {
ticker: string
exchange: string
}
/** Raw company shape as returned by the Quartr API (`CompanyDto`). */
export interface QuartrCompanyDto {
id: number
name: string
displayName?: string
country: string
tickers?: QuartrTicker[]
isins?: string[]
cik?: string
openfigi?: string[]
backlinkUrl: string
createdAt: string
updatedAt: string
}
/** Raw event shape as returned by the Quartr API (`EventDto`). */
export interface QuartrEventDto {
id: number
companyId: number
title: string
date: string
typeId: number
fiscalYear?: number
fiscalPeriod?: string
language: string
backlinkUrl: string
createdAt: string
updatedAt: string
}
/** Raw expanded event shape embedded on documents and audio (`ExpandedEventDto`). */
export interface QuartrExpandedEventDto {
title?: string
typeId?: number
fiscalYear?: number
fiscalPeriod?: string
language?: string
date?: string
}
/** Raw document shape as returned by the Quartr API (`DocumentDto`). */
export interface QuartrDocumentDto {
id: number
companyId?: number
eventId?: number
typeId: number
fileUrl: string
createdAt: string
updatedAt: string
event?: QuartrExpandedEventDto
}
/** Raw summary source as returned by the Quartr API (`SummarySource`). */
export interface QuartrSummarySourceDto {
sourceId?: string
documentId: number
page?: number
timestamp?: number
typeId: number
}
/** Raw summary shape as returned by the Quartr API (`SummaryDto`). */
export interface QuartrSummaryDto {
id: number
summary: string
sources: QuartrSummarySourceDto[]
createdAt: string
updatedAt: string
}
/** Raw audio metadata as returned by the Quartr API (`AudioMetadataDto`). */
export interface QuartrAudioMetadataDto {
size?: string
duration?: number
encoding?: string
mimetype?: string
}
/** Raw audio shape as returned by the Quartr API (`AudioDto`). */
export interface QuartrAudioDto {
id: number
companyId: number
eventId: number
fileUrl?: string
streamUrl?: string
qna?: number
audioMetadata?: QuartrAudioMetadataDto
createdAt: string
updatedAt: string
event?: QuartrExpandedEventDto
}
/** Raw live event shape as returned by the Quartr API (`LiveDto`). */
export interface QuartrLiveEventDto {
id: number
eventId: number
companyId: number
date: string
wentLiveAt?: string
state?: string
audio?: string
transcript?: string
createdAt: string
updatedAt: string
}
/** Raw event type shape as returned by the Quartr API (`EventTypeDto`). */
export interface QuartrEventTypeDto {
id: number
name?: string
parent?: string
createdAt: string
updatedAt: string
}
/** Raw document type shape as returned by the Quartr API (`DocumentTypeDto`). */
export interface QuartrDocumentTypeDto {
id: number
name: string
description?: string
form?: string
category: string
documentGroupId?: number
createdAt: string
updatedAt: string
}
/** Cursor pagination envelope returned by Quartr list endpoints. */
export interface QuartrPaginationDto {
nextCursor: number | null
}
/** Paginated list envelope returned by Quartr list endpoints. */
export interface QuartrPaginatedDto<T> {
data: T[]
pagination: QuartrPaginationDto
}
/** Single-resource envelope returned by Quartr retrieve endpoints. */
export interface QuartrSingleDto<T> {
data: T
}
/** Company with nullable optional fields, as emitted in tool outputs. */
export interface QuartrCompany {
id: number
name: string
displayName: string | null
country: string
tickers: QuartrTicker[]
isins: string[]
cik: string | null
openfigi: string[]
backlinkUrl: string
createdAt: string
updatedAt: string
}
/** Event with nullable optional fields, as emitted in tool outputs. */
export interface QuartrEvent {
id: number
companyId: number
title: string
date: string
typeId: number
fiscalYear: number | null
fiscalPeriod: string | null
language: string
backlinkUrl: string
createdAt: string
updatedAt: string
}
/** Expanded event with nullable optional fields, as emitted in tool outputs. */
export interface QuartrExpandedEvent {
title: string | null
typeId: number | null
fiscalYear: number | null
fiscalPeriod: string | null
language: string | null
date: string | null
}
/** Document with nullable optional fields, as emitted in tool outputs. */
export interface QuartrDocument {
id: number
companyId: number | null
eventId: number | null
typeId: number
fileUrl: string
createdAt: string
updatedAt: string
event: QuartrExpandedEvent | null
}
/** Summary source with nullable optional fields, as emitted in tool outputs. */
export interface QuartrSummarySource {
sourceId: string | null
documentId: number
page: number | null
timestamp: number | null
typeId: number
}
/** Audio metadata with nullable optional fields, as emitted in tool outputs. */
export interface QuartrAudioMetadata {
size: string | null
duration: number | null
encoding: string | null
mimetype: string | null
}
/** Audio recording with nullable optional fields, as emitted in tool outputs. */
export interface QuartrAudio {
id: number
companyId: number
eventId: number
fileUrl: string | null
streamUrl: string | null
qna: number | null
audioMetadata: QuartrAudioMetadata | null
createdAt: string
updatedAt: string
event: QuartrExpandedEvent | null
}
/** Live event with nullable optional fields, as emitted in tool outputs. */
export interface QuartrLiveEvent {
id: number
eventId: number
companyId: number
date: string
wentLiveAt: string | null
state: string | null
audio: string | null
transcript: string | null
createdAt: string
updatedAt: string
}
/** Event type with nullable optional fields, as emitted in tool outputs. */
export interface QuartrEventType {
id: number
name: string | null
parent: string | null
createdAt: string
updatedAt: string
}
/** Document type with nullable optional fields, as emitted in tool outputs. */
export interface QuartrDocumentType {
id: number
name: string
description: string | null
form: string | null
category: string
documentGroupId: number | null
createdAt: string
updatedAt: string
}
/** Cursor pagination parameters shared by all Quartr list tools. */
export interface QuartrPaginationParams {
limit?: number | string
cursor?: number | string
direction?: string
}
/** `updatedAt` range filters shared by Quartr list tools. */
export interface QuartrUpdatedRangeParams {
updatedAfter?: string
updatedBefore?: string
}
/** Company identifier filters shared by Quartr list tools. */
export interface QuartrCompanyFilterParams {
tickers?: string
isins?: string
ciks?: string
countries?: string
exchanges?: string
}
export interface QuartrListCompaniesParams
extends QuartrCompanyFilterParams,
QuartrPaginationParams,
QuartrUpdatedRangeParams {
apiKey: string
companyIds?: string
openfigis?: string
}
export interface QuartrGetCompanyParams {
apiKey: string
companyId: number | string
}
export interface QuartrListEventsParams
extends QuartrCompanyFilterParams,
QuartrPaginationParams,
QuartrUpdatedRangeParams {
apiKey: string
companyIds?: string
eventTypeIds?: string
startDate?: string
endDate?: string
sortBy?: string
}
export interface QuartrGetEventParams {
apiKey: string
eventId: number | string
}
export interface QuartrGetEventSummaryParams {
apiKey: string
eventId: number | string
summaryLength?: string
plainSummary?: boolean | string
}
export interface QuartrListEventTypesParams extends QuartrPaginationParams {
apiKey: string
}
export interface QuartrListDocumentTypesParams extends QuartrPaginationParams {
apiKey: string
}
/** Filters shared by the documents, reports, slide decks, and transcripts list tools. */
export interface QuartrListDocumentsParams
extends QuartrCompanyFilterParams,
QuartrPaginationParams,
QuartrUpdatedRangeParams {
apiKey: string
companyIds?: string
eventIds?: string
documentTypeIds?: string
documentGroupIds?: string
startDate?: string
endDate?: string
expandEvent?: boolean | string
}
export interface QuartrGetReportParams {
apiKey: string
reportId: number | string
}
export interface QuartrGetSlideDeckParams {
apiKey: string
slideDeckId: number | string
}
export interface QuartrGetTranscriptParams {
apiKey: string
transcriptId: number | string
}
export interface QuartrListAudioParams
extends QuartrCompanyFilterParams,
QuartrPaginationParams,
QuartrUpdatedRangeParams {
apiKey: string
companyIds?: string
eventIds?: string
startDate?: string
endDate?: string
expandEvent?: boolean | string
}
export interface QuartrGetAudioParams {
apiKey: string
audioId: number | string
}
export interface QuartrListLiveEventsParams
extends QuartrCompanyFilterParams,
QuartrPaginationParams,
QuartrUpdatedRangeParams {
apiKey: string
companyIds?: string
eventIds?: string
states?: string
startDate?: string
endDate?: string
transcriptVersion?: string
}
export interface QuartrListCompaniesResponse extends ToolResponse {
output: {
companies: QuartrCompany[]
nextCursor: number | null
}
}
export interface QuartrGetCompanyResponse extends ToolResponse {
output: {
company: QuartrCompany
}
}
export interface QuartrListEventsResponse extends ToolResponse {
output: {
events: QuartrEvent[]
nextCursor: number | null
}
}
export interface QuartrGetEventResponse extends ToolResponse {
output: {
event: QuartrEvent
}
}
export interface QuartrGetEventSummaryResponse extends ToolResponse {
output: {
summary: string
sources: QuartrSummarySource[]
summaryId: number
summaryCreatedAt: string
summaryUpdatedAt: string
}
}
export interface QuartrListEventTypesResponse extends ToolResponse {
output: {
eventTypes: QuartrEventType[]
nextCursor: number | null
}
}
export interface QuartrListDocumentTypesResponse extends ToolResponse {
output: {
documentTypes: QuartrDocumentType[]
nextCursor: number | null
}
}
export interface QuartrListDocumentsResponse extends ToolResponse {
output: {
documents: QuartrDocument[]
nextCursor: number | null
}
}
export interface QuartrListReportsResponse extends ToolResponse {
output: {
reports: QuartrDocument[]
nextCursor: number | null
}
}
export interface QuartrListSlideDecksResponse extends ToolResponse {
output: {
slideDecks: QuartrDocument[]
nextCursor: number | null
}
}
export interface QuartrListTranscriptsResponse extends ToolResponse {
output: {
transcripts: QuartrDocument[]
nextCursor: number | null
}
}
export interface QuartrGetDocumentFileResponse extends ToolResponse {
output: {
document: QuartrDocument
fileUrl: string
file: ToolFileData
}
}
export interface QuartrListAudioResponse extends ToolResponse {
output: {
audioRecordings: QuartrAudio[]
nextCursor: number | null
}
}
export interface QuartrGetAudioResponse extends ToolResponse {
output: {
audio: QuartrAudio
}
}
export interface QuartrListLiveEventsResponse extends ToolResponse {
output: {
liveEvents: QuartrLiveEvent[]
nextCursor: number | null
}
}
export const QUARTR_TICKER_OUTPUT_PROPERTIES = {
ticker: { type: 'string', description: 'Ticker symbol' },
exchange: { type: 'string', description: 'Exchange symbol' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_COMPANY_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Quartr company ID' },
name: { type: 'string', description: 'Legal company name' },
displayName: { type: 'string', description: 'Display name', nullable: true },
country: { type: 'string', description: 'ISO 3166-1 alpha-2 country code' },
tickers: {
type: 'array',
description: 'Ticker listings for the company',
items: { type: 'object', properties: QUARTR_TICKER_OUTPUT_PROPERTIES },
},
isins: { type: 'array', description: 'ISINs for the company', items: { type: 'string' } },
cik: { type: 'string', description: 'SEC Central Index Key', nullable: true },
openfigi: {
type: 'array',
description: 'OpenFIGI share class identifiers',
items: { type: 'string' },
},
backlinkUrl: { type: 'string', description: 'Quartr backlink URL for the company' },
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_EVENT_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Quartr event ID' },
companyId: { type: 'number', description: 'Quartr company ID' },
title: { type: 'string', description: 'Event title (e.g., "Q1 2024")' },
date: { type: 'string', description: 'Event date (ISO 8601)' },
typeId: { type: 'number', description: 'Event type ID' },
fiscalYear: { type: 'number', description: 'Fiscal year', nullable: true },
fiscalPeriod: { type: 'string', description: 'Fiscal period (e.g., "Q1")', nullable: true },
language: { type: 'string', description: 'Event language code' },
backlinkUrl: { type: 'string', description: 'Quartr backlink URL for the event' },
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_EXPANDED_EVENT_OUTPUT_PROPERTIES = {
title: { type: 'string', description: 'Event title', nullable: true },
typeId: { type: 'number', description: 'Event type ID', nullable: true },
fiscalYear: { type: 'number', description: 'Fiscal year', nullable: true },
fiscalPeriod: { type: 'string', description: 'Fiscal period (e.g., "Q1")', nullable: true },
language: { type: 'string', description: 'Event language code', nullable: true },
date: { type: 'string', description: 'Event date (ISO 8601)', nullable: true },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_DOCUMENT_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Quartr document ID' },
companyId: { type: 'number', description: 'Quartr company ID', nullable: true },
eventId: { type: 'number', description: 'Quartr event ID', nullable: true },
typeId: { type: 'number', description: 'Document type ID' },
fileUrl: { type: 'string', description: 'URL of the document file' },
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
event: {
type: 'object',
description: 'Expanded event details (present when event expansion is requested)',
nullable: true,
properties: QUARTR_EXPANDED_EVENT_OUTPUT_PROPERTIES,
},
} as const satisfies Record<string, OutputProperty>
export const QUARTR_SUMMARY_SOURCE_OUTPUT_PROPERTIES = {
sourceId: {
type: 'string',
description: 'ID linking the source document to tags embedded in the summary',
nullable: true,
},
documentId: { type: 'number', description: 'Quartr document ID of the source' },
page: {
type: 'number',
description: 'Page number or timestamp in seconds depending on the document type',
nullable: true,
},
timestamp: { type: 'number', description: 'Timestamp in seconds', nullable: true },
typeId: { type: 'number', description: 'Document type ID of the source' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_AUDIO_METADATA_OUTPUT_PROPERTIES = {
size: { type: 'string', description: 'File size (e.g., "200.00 MB")', nullable: true },
duration: { type: 'number', description: 'Duration in seconds', nullable: true },
encoding: { type: 'string', description: 'Audio encoding', nullable: true },
mimetype: { type: 'string', description: 'Audio MIME type', nullable: true },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_AUDIO_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Quartr audio ID' },
companyId: { type: 'number', description: 'Quartr company ID' },
eventId: { type: 'number', description: 'Quartr event ID' },
fileUrl: { type: 'string', description: 'Download URL of the audio file (MPEG)', nullable: true },
streamUrl: {
type: 'string',
description: 'Streaming URL of the audio (M3U8)',
nullable: true,
},
qna: {
type: 'number',
description: 'Timestamp in seconds where the Q&A section starts',
nullable: true,
},
audioMetadata: {
type: 'object',
description: 'Audio file metadata',
nullable: true,
properties: QUARTR_AUDIO_METADATA_OUTPUT_PROPERTIES,
},
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
event: {
type: 'object',
description: 'Expanded event details (present when event expansion is requested)',
nullable: true,
properties: QUARTR_EXPANDED_EVENT_OUTPUT_PROPERTIES,
},
} as const satisfies Record<string, OutputProperty>
export const QUARTR_LIVE_EVENT_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Quartr live event ID' },
eventId: { type: 'number', description: 'Quartr event ID' },
companyId: { type: 'number', description: 'Quartr company ID' },
date: { type: 'string', description: 'Scheduled event date (ISO 8601)' },
wentLiveAt: {
type: 'string',
description: 'Timestamp when the event went live (ISO 8601)',
nullable: true,
},
state: {
type: 'string',
description:
'Live state (notLive, willBeLive, live, liveFailedInterrupted, liveFailedNoAccess, liveFailedNotStarted, processingRecording, processingRecordingFailed, recordingAvailable)',
nullable: true,
},
audio: {
type: 'string',
description: 'URL of the live audio stream or recording',
nullable: true,
},
transcript: {
type: 'string',
description: 'URL of the live transcript stream (JSON Lines)',
nullable: true,
},
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_EVENT_TYPE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Event type ID' },
name: { type: 'string', description: 'Event type name (e.g., "Q1")', nullable: true },
parent: {
type: 'string',
description: 'Parent event type name (e.g., "Earnings call")',
nullable: true,
},
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
export const QUARTR_DOCUMENT_TYPE_OUTPUT_PROPERTIES = {
id: { type: 'number', description: 'Document type ID' },
name: { type: 'string', description: 'Document type name (e.g., "Quarterly Report")' },
description: { type: 'string', description: 'Document type description', nullable: true },
form: { type: 'string', description: 'Filing form (e.g., "10-Q")', nullable: true },
category: { type: 'string', description: 'Document category (e.g., "Report")' },
documentGroupId: { type: 'number', description: 'Document group ID', nullable: true },
createdAt: { type: 'string', description: 'Creation timestamp (ISO 8601)' },
updatedAt: { type: 'string', description: 'Last update timestamp (ISO 8601)' },
} as const satisfies Record<string, OutputProperty>
+274
View File
@@ -0,0 +1,274 @@
import type {
QuartrAudio,
QuartrAudioDto,
QuartrCompany,
QuartrCompanyDto,
QuartrCompanyFilterParams,
QuartrDocument,
QuartrDocumentDto,
QuartrDocumentType,
QuartrDocumentTypeDto,
QuartrEvent,
QuartrEventDto,
QuartrEventType,
QuartrEventTypeDto,
QuartrExpandedEvent,
QuartrExpandedEventDto,
QuartrListDocumentsParams,
QuartrLiveEvent,
QuartrLiveEventDto,
QuartrPaginationParams,
QuartrSummarySource,
QuartrSummarySourceDto,
QuartrUpdatedRangeParams,
} from '@/tools/quartr/types'
export const QUARTR_API_BASE_URL = 'https://api.quartr.com/public/v3'
/**
* Normalizes a comma-separated list value by trimming whitespace around each
* entry, since the Quartr API expects lists without blank spaces.
*/
export function normalizeQuartrCommaList(
value: string | number | null | undefined
): string | undefined {
if (value == null || value === '') return undefined
const normalized = String(value)
.split(',')
.map((entry) => entry.trim())
.filter(Boolean)
.join(',')
return normalized || undefined
}
/**
* Interprets a boolean-ish tool param, accepting boolean true or the string
* "true" (agent tool configuration serializes switch values as strings).
*/
export function isQuartrToggleEnabled(value: boolean | string | null | undefined): boolean {
return value === true || value === 'true'
}
/**
* Builds a Quartr API URL, appending only query parameters that have a value.
*/
export function buildQuartrUrl(
path: string,
query?: Record<string, string | number | boolean | null | undefined>
): string {
const url = new URL(`${QUARTR_API_BASE_URL}${path}`)
if (query) {
for (const [key, value] of Object.entries(query)) {
if (value == null || value === '') continue
url.searchParams.set(key, String(value))
}
}
return url.toString()
}
/**
* Builds the query parameters shared by all Quartr list tools: company
* identifier filters, pagination, and updatedAt range filters.
*/
export function buildQuartrListQuery(
params: QuartrCompanyFilterParams & QuartrPaginationParams & QuartrUpdatedRangeParams
): Record<string, string | number | boolean | undefined> {
return {
tickers: normalizeQuartrCommaList(params.tickers),
isins: normalizeQuartrCommaList(params.isins),
ciks: normalizeQuartrCommaList(params.ciks),
countries: normalizeQuartrCommaList(params.countries),
exchanges: normalizeQuartrCommaList(params.exchanges),
limit: params.limit,
cursor: params.cursor,
direction: params.direction,
updatedAfter: params.updatedAfter,
updatedBefore: params.updatedBefore,
}
}
/**
* Builds the query parameters shared by the documents, reports, slide decks,
* and transcripts list tools.
*/
export function buildQuartrDocumentListQuery(
params: QuartrListDocumentsParams
): Record<string, string | number | boolean | undefined> {
return {
...buildQuartrListQuery(params),
companyIds: normalizeQuartrCommaList(params.companyIds),
eventIds: normalizeQuartrCommaList(params.eventIds),
typeIds: normalizeQuartrCommaList(params.documentTypeIds),
documentGroupIds: normalizeQuartrCommaList(params.documentGroupIds),
startDate: params.startDate,
endDate: params.endDate,
expand: isQuartrToggleEnabled(params.expandEvent) ? 'event' : undefined,
}
}
/**
* Parses a Quartr API response, throwing a descriptive error for failures.
*/
export async function parseQuartrResponse<T>(response: Response, operation: string): Promise<T> {
const text = await response.text()
let data: unknown
try {
data = JSON.parse(text)
} catch {
data = undefined
}
if (!response.ok) {
const body = data as
| { message?: string | Array<string | { field?: string; message?: string }>; error?: string }
| undefined
const rawMessage = body?.message ?? body?.error ?? `HTTP ${response.status}`
const message = Array.isArray(rawMessage)
? rawMessage
.map((entry) => {
if (typeof entry === 'string') return entry
if (typeof entry?.message === 'string') {
return entry.field ? `${entry.field}: ${entry.message}` : entry.message
}
return JSON.stringify(entry)
})
.join('; ')
: rawMessage
throw new Error(`Quartr ${operation} failed (${response.status}): ${message}`)
}
if (data === undefined) {
throw new Error(`Quartr ${operation} returned an invalid JSON response`)
}
return data as T
}
export function mapQuartrCompany(dto: QuartrCompanyDto): QuartrCompany {
return {
id: dto.id,
name: dto.name,
displayName: dto.displayName ?? null,
country: dto.country,
tickers: dto.tickers ?? [],
isins: dto.isins ?? [],
cik: dto.cik ?? null,
openfigi: dto.openfigi ?? [],
backlinkUrl: dto.backlinkUrl,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
}
}
export function mapQuartrEvent(dto: QuartrEventDto): QuartrEvent {
return {
id: dto.id,
companyId: dto.companyId,
title: dto.title,
date: dto.date,
typeId: dto.typeId,
fiscalYear: dto.fiscalYear ?? null,
fiscalPeriod: dto.fiscalPeriod ?? null,
language: dto.language,
backlinkUrl: dto.backlinkUrl,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
}
}
export function mapQuartrExpandedEvent(
dto: QuartrExpandedEventDto | undefined
): QuartrExpandedEvent | null {
if (!dto) return null
return {
title: dto.title ?? null,
typeId: dto.typeId ?? null,
fiscalYear: dto.fiscalYear ?? null,
fiscalPeriod: dto.fiscalPeriod ?? null,
language: dto.language ?? null,
date: dto.date ?? null,
}
}
export function mapQuartrDocument(dto: QuartrDocumentDto): QuartrDocument {
return {
id: dto.id,
companyId: dto.companyId ?? null,
eventId: dto.eventId ?? null,
typeId: dto.typeId,
fileUrl: dto.fileUrl,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
event: mapQuartrExpandedEvent(dto.event),
}
}
export function mapQuartrSummarySource(dto: QuartrSummarySourceDto): QuartrSummarySource {
return {
sourceId: dto.sourceId ?? null,
documentId: dto.documentId,
page: dto.page ?? null,
timestamp: dto.timestamp ?? null,
typeId: dto.typeId,
}
}
export function mapQuartrAudio(dto: QuartrAudioDto): QuartrAudio {
return {
id: dto.id,
companyId: dto.companyId,
eventId: dto.eventId,
fileUrl: dto.fileUrl ?? null,
streamUrl: dto.streamUrl ?? null,
qna: dto.qna ?? null,
audioMetadata: dto.audioMetadata
? {
size: dto.audioMetadata.size ?? null,
duration: dto.audioMetadata.duration ?? null,
encoding: dto.audioMetadata.encoding ?? null,
mimetype: dto.audioMetadata.mimetype ?? null,
}
: null,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
event: mapQuartrExpandedEvent(dto.event),
}
}
export function mapQuartrLiveEvent(dto: QuartrLiveEventDto): QuartrLiveEvent {
return {
id: dto.id,
eventId: dto.eventId,
companyId: dto.companyId,
date: dto.date,
wentLiveAt: dto.wentLiveAt ?? null,
state: dto.state ?? null,
audio: dto.audio ?? null,
transcript: dto.transcript ?? null,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
}
}
export function mapQuartrEventType(dto: QuartrEventTypeDto): QuartrEventType {
return {
id: dto.id,
name: dto.name ?? null,
parent: dto.parent ?? null,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
}
}
export function mapQuartrDocumentType(dto: QuartrDocumentTypeDto): QuartrDocumentType {
return {
id: dto.id,
name: dto.name,
description: dto.description ?? null,
form: dto.form ?? null,
category: dto.category,
documentGroupId: dto.documentGroupId ?? null,
createdAt: dto.createdAt,
updatedAt: dto.updatedAt,
}
}