Skip to content

Commit ba253ab

Browse files
committed
fix(convex): rename List Documents pagination cursor to pageCursor end-to-end for unambiguous chaining
1 parent ff9a404 commit ba253ab

5 files changed

Lines changed: 25 additions & 27 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ List all tables in a Convex deployment along with their JSON schemas
140140

141141
### `convex_list_documents`
142142

143-
List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and cursor back in to fetch the next page.
143+
List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and page cursor back in to fetch the next page.
144144

145145
#### Input
146146

@@ -150,7 +150,7 @@ List documents from a Convex table via a paginated snapshot. Pass the returned s
150150
| `deployKey` | string | Yes | Convex deploy key from the dashboard Settings page |
151151
| `tableName` | string | No | Table to list documents from. Omit to list documents from all tables. |
152152
| `snapshot` | string | No | Snapshot timestamp from a previous page. Omit on the first request to start a new snapshot. |
153-
| `cursor` | string | No | Pagination cursor from a previous page. Omit on the first request. |
153+
| `pageCursor` | string | No | Page cursor from a previous page of the same snapshot. Omit on the first request. |
154154

155155
#### Output
156156

@@ -159,7 +159,7 @@ List documents from a Convex table via a paginated snapshot. Pass the returned s
159159
| `documents` | array | Documents in this page of the snapshot |
160160
| `hasMore` | boolean | Whether more pages remain in the snapshot |
161161
| `snapshot` | string | Snapshot timestamp to pass back in when fetching the next page |
162-
| `cursor` | string | Pagination cursor to pass back in when fetching the next page |
162+
| `pageCursor` | string | Page cursor to pass back in when fetching the next page |
163163

164164
### `convex_document_deltas`
165165

apps/sim/blocks/blocks/convex.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,6 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
144144
throw new Error(`Invalid Convex operation: ${params.operation}`)
145145
}
146146
},
147-
params: (params) => {
148-
const { pageCursor, ...rest } = params
149-
150-
if (params.operation === 'list_documents') {
151-
rest.cursor = pageCursor
152-
}
153-
154-
return rest
155-
},
156147
},
157148
},
158149
inputs: {
@@ -164,7 +155,7 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
164155
tableName: { type: 'string', description: 'Table to read from (empty for all tables)' },
165156
snapshot: { type: 'string', description: 'Snapshot timestamp for List Documents pagination' },
166157
cursor: { type: 'string', description: 'Timestamp cursor for Document Deltas' },
167-
pageCursor: { type: 'string', description: 'Pagination cursor for List Documents' },
158+
pageCursor: { type: 'string', description: 'Page cursor for List Documents pagination' },
168159
},
169160
outputs: {
170161
value: {
@@ -193,11 +184,15 @@ Return ONLY the JSON object - no explanations, no markdown, no extra text.`,
193184
},
194185
snapshot: {
195186
type: 'string',
196-
description: 'Snapshot timestamp to pass back in for the next page',
187+
description: 'Snapshot timestamp to pass back in for the next List Documents page',
188+
},
189+
pageCursor: {
190+
type: 'string',
191+
description: 'Page cursor to pass back in for the next List Documents page',
197192
},
198193
cursor: {
199194
type: 'string',
200-
description: 'Cursor to pass back in for the next page',
195+
description: 'Timestamp cursor to pass back in for the next Document Deltas page',
201196
},
202197
},
203198
}
@@ -289,7 +284,7 @@ export const ConvexBlockMeta = {
289284
description:
290285
'Page through a full Convex table snapshot with List Documents until hasMore is false.',
291286
content:
292-
'# Export a Convex Table\n\nRead every document in a table using snapshot pagination so the export is consistent.\n\n## Steps\n1. Use the List Documents operation with the deployment URL, deploy key, and the table name (leave empty to export all tables).\n2. On the first call leave Snapshot and Cursor empty; the response pins a snapshot timestamp.\n3. While hasMore is true, call List Documents again passing back the returned snapshot and cursor values.\n4. Collect the documents arrays from each page into your destination.\n\n## Output\nA complete, point-in-time set of documents for the table, each including _id and _creationTime.',
287+
'# Export a Convex Table\n\nRead every document in a table using snapshot pagination so the export is consistent.\n\n## Steps\n1. Use the List Documents operation with the deployment URL, deploy key, and the table name (leave empty to export all tables).\n2. On the first call leave Snapshot and Cursor empty; the response pins a snapshot timestamp.\n3. While hasMore is true, call List Documents again passing back the returned snapshot and pageCursor values.\n4. Collect the documents arrays from each page into your destination.\n\n## Output\nA complete, point-in-time set of documents for the table, each including _id and _creationTime.',
293288
},
294289
{
295290
name: 'sync-convex-changes',

apps/sim/lib/integrations/integrations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3228,7 +3228,7 @@
32283228
},
32293229
{
32303230
"name": "List Documents",
3231-
"description": "List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and cursor back in to fetch the next page."
3231+
"description": "List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and page cursor back in to fetch the next page."
32323232
},
32333233
{
32343234
"name": "Document Deltas",

apps/sim/tools/convex/list_documents.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const listDocumentsTool: ToolConfig<ConvexListDocumentsParams, ConvexList
1111
id: 'convex_list_documents',
1212
name: 'Convex List Documents',
1313
description:
14-
'List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and cursor back in to fetch the next page.',
14+
'List documents from a Convex table via a paginated snapshot. Pass the returned snapshot and page cursor back in to fetch the next page.',
1515
version: '1.0.0',
1616

1717
params: {
@@ -40,11 +40,12 @@ export const listDocumentsTool: ToolConfig<ConvexListDocumentsParams, ConvexList
4040
description:
4141
'Snapshot timestamp from a previous page. Omit on the first request to start a new snapshot.',
4242
},
43-
cursor: {
43+
pageCursor: {
4444
type: 'string',
4545
required: false,
4646
visibility: 'user-or-llm',
47-
description: 'Pagination cursor from a previous page. Omit on the first request.',
47+
description:
48+
'Page cursor from a previous page of the same snapshot. Omit on the first request.',
4849
},
4950
},
5051

@@ -54,8 +55,8 @@ export const listDocumentsTool: ToolConfig<ConvexListDocumentsParams, ConvexList
5455
if (params.tableName?.trim()) query.set('tableName', params.tableName.trim())
5556
const snapshot = String(params.snapshot ?? '').trim()
5657
if (snapshot) query.set('snapshot', snapshot)
57-
const cursor = String(params.cursor ?? '').trim()
58-
if (cursor) query.set('cursor', cursor)
58+
const pageCursor = String(params.pageCursor ?? '').trim()
59+
if (pageCursor) query.set('cursor', pageCursor)
5960
return convexApiUrl(params.deploymentUrl, `/api/list_snapshot?${query.toString()}`)
6061
},
6162
method: 'GET',
@@ -72,7 +73,8 @@ export const listDocumentsTool: ToolConfig<ConvexListDocumentsParams, ConvexList
7273
hasMore: data.hasMore ?? false,
7374
snapshot:
7475
data.snapshot !== undefined && data.snapshot !== null ? String(data.snapshot) : null,
75-
cursor: data.cursor !== undefined && data.cursor !== null ? String(data.cursor) : null,
76+
pageCursor:
77+
data.cursor !== undefined && data.cursor !== null ? String(data.cursor) : null,
7678
},
7779
}
7880
},
@@ -92,9 +94,9 @@ export const listDocumentsTool: ToolConfig<ConvexListDocumentsParams, ConvexList
9294
description: 'Snapshot timestamp to pass back in when fetching the next page',
9395
optional: true,
9496
},
95-
cursor: {
97+
pageCursor: {
9698
type: 'string',
97-
description: 'Pagination cursor to pass back in when fetching the next page',
99+
description: 'Page cursor to pass back in when fetching the next page',
98100
optional: true,
99101
},
100102
},

apps/sim/tools/convex/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ export interface ConvexListTablesResponse extends ToolResponse {
3535
export interface ConvexListDocumentsParams extends ConvexBaseParams {
3636
tableName?: string
3737
snapshot?: string
38-
cursor?: string
38+
pageCursor?: string
3939
}
4040

4141
export interface ConvexListDocumentsResponse extends ToolResponse {
4242
output: {
4343
documents: unknown[]
4444
hasMore: boolean
4545
snapshot: string | null
46-
cursor: string | null
46+
pageCursor: string | null
4747
}
4848
}
4949

@@ -97,6 +97,7 @@ export interface ConvexResponse extends ToolResponse {
9797
documents?: unknown[]
9898
hasMore?: boolean
9999
snapshot?: string | null
100+
pageCursor?: string | null
100101
cursor?: string | null
101102
}
102103
}

0 commit comments

Comments
 (0)