d25d482dc2
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
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
97 lines
3.1 KiB
TypeScript
97 lines
3.1 KiB
TypeScript
import type { PolymarketEvent } from '@/tools/polymarket/types'
|
|
import { buildGammaUrl, handlePolymarketError } from '@/tools/polymarket/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export interface PolymarketGetEventParams {
|
|
eventId?: string // Event ID
|
|
slug?: string // Event slug (alternative to ID)
|
|
}
|
|
|
|
export interface PolymarketGetEventResponse {
|
|
success: boolean
|
|
output: {
|
|
event: PolymarketEvent
|
|
}
|
|
}
|
|
|
|
export const polymarketGetEventTool: ToolConfig<
|
|
PolymarketGetEventParams,
|
|
PolymarketGetEventResponse
|
|
> = {
|
|
id: 'polymarket_get_event',
|
|
name: 'Get Event from Polymarket',
|
|
description: 'Retrieve details of a specific event by ID or slug',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
eventId: {
|
|
type: 'string',
|
|
required: false,
|
|
description: 'The numeric event ID (e.g., "12345"). Required if slug is not provided.',
|
|
visibility: 'user-or-llm',
|
|
},
|
|
slug: {
|
|
type: 'string',
|
|
required: false,
|
|
description:
|
|
'The event slug (e.g., "2024-presidential-election"). URL-friendly identifier. Required if eventId is not provided.',
|
|
visibility: 'user-or-llm',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
if (params.slug) {
|
|
return buildGammaUrl(`/events/slug/${params.slug.trim()}`)
|
|
}
|
|
return buildGammaUrl(`/events/${params.eventId?.trim()}`)
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
if (!response.ok) {
|
|
handlePolymarketError(data, response.status, 'get_event')
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
event: data,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
event: {
|
|
type: 'object',
|
|
description: 'Event object with details',
|
|
properties: {
|
|
id: { type: 'string', description: 'Event ID' },
|
|
ticker: { type: 'string', description: 'Event ticker' },
|
|
slug: { type: 'string', description: 'Event slug' },
|
|
title: { type: 'string', description: 'Event title' },
|
|
description: { type: 'string', description: 'Event description' },
|
|
startDate: { type: 'string', description: 'Start date' },
|
|
creationDate: { type: 'string', description: 'Creation date' },
|
|
endDate: { type: 'string', description: 'End date' },
|
|
image: { type: 'string', description: 'Event image URL' },
|
|
icon: { type: 'string', description: 'Event icon URL' },
|
|
active: { type: 'boolean', description: 'Whether event is active' },
|
|
closed: { type: 'boolean', description: 'Whether event is closed' },
|
|
archived: { type: 'boolean', description: 'Whether event is archived' },
|
|
liquidity: { type: 'number', description: 'Total liquidity' },
|
|
volume: { type: 'number', description: 'Total volume' },
|
|
openInterest: { type: 'number', description: 'Open interest' },
|
|
commentCount: { type: 'number', description: 'Comment count' },
|
|
markets: { type: 'array', description: 'Array of markets in this event' },
|
|
},
|
|
},
|
|
},
|
|
}
|