Skip to content

Commit 105d966

Browse files
committed
fix(integrations): validate context.dev country (ISO-2); regenerate google_docs docs
- context_dev/search: reject non-2-letter country values with a clear error instead of forwarding them - docs: regenerate google_docs.mdx so the public index-contract wording matches the updated tool descriptions (body starts at index 1)
1 parent 80a36f4 commit 105d966

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Insert text at a specific index in a Google Docs document. When no index is prov
110110
| --------- | ---- | -------- | ----------- |
111111
| `documentId` | string | Yes | The ID of the document to insert text into |
112112
| `text` | string | Yes | The text to insert |
113-
| `index` | number | No | The zero-based character index at which to insert the text. When omitted, text is appended to the end of the document. |
113+
| `index` | number | No | The character index \(the document body starts at index 1\) at which to insert the text. When omitted, text is appended to the end of the document. |
114114

115115
#### Output
116116

@@ -158,7 +158,7 @@ Insert an empty table with the given number of rows and columns into a Google Do
158158
| `documentId` | string | Yes | The ID of the document to insert the table into |
159159
| `rows` | number | Yes | The number of rows in the table |
160160
| `columns` | number | Yes | The number of columns in the table |
161-
| `index` | number | No | The zero-based character index at which to insert the table. When omitted, the table is appended to the end of the document. |
161+
| `index` | number | No | The character index \(the document body starts at index 1\) at which to insert the table. When omitted, the table is appended to the end of the document. |
162162

163163
#### Output
164164

@@ -181,7 +181,7 @@ Insert an inline image from a public URL into a Google Docs document. The image
181181
| --------- | ---- | -------- | ----------- |
182182
| `documentId` | string | Yes | The ID of the document to insert the image into |
183183
| `imageUrl` | string | Yes | The publicly accessible URL of the image to insert |
184-
| `index` | number | No | The zero-based character index at which to insert the image. When omitted, the image is appended to the end of the document. |
184+
| `index` | number | No | The character index \(the document body starts at index 1\) at which to insert the image. When omitted, the image is appended to the end of the document. |
185185
| `width` | number | No | Optional image width in points \(PT\) |
186186
| `height` | number | No | Optional image height in points \(PT\) |
187187

@@ -205,7 +205,7 @@ Insert a page break into a Google Docs document. When no index is provided, the
205205
| Parameter | Type | Required | Description |
206206
| --------- | ---- | -------- | ----------- |
207207
| `documentId` | string | Yes | The ID of the document to insert the page break into |
208-
| `index` | number | No | The zero-based character index at which to insert the page break. When omitted, the page break is appended to the end of the document. |
208+
| `index` | number | No | The character index \(the document body starts at index 1\) at which to insert the page break. When omitted, the page break is appended to the end of the document. |
209209

210210
#### Output
211211

@@ -227,7 +227,7 @@ Apply bold, italic, underline, and/or font size to a range of text in a Google D
227227
| Parameter | Type | Required | Description |
228228
| --------- | ---- | -------- | ----------- |
229229
| `documentId` | string | Yes | The ID of the document to update |
230-
| `startIndex` | number | Yes | The zero-based start character index of the range to style \(inclusive\) |
230+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range to style \(inclusive\) |
231231
| `endIndex` | number | Yes | The end character index of the range to style \(exclusive\) |
232232
| `bold` | boolean | No | Whether to make the text bold |
233233
| `italic` | boolean | No | Whether to make the text italic |
@@ -254,7 +254,7 @@ Apply a named paragraph style (such as a heading or title) and/or alignment to t
254254
| Parameter | Type | Required | Description |
255255
| --------- | ---- | -------- | ----------- |
256256
| `documentId` | string | Yes | The ID of the document to update |
257-
| `startIndex` | number | Yes | The zero-based start character index of the range to style \(inclusive\) |
257+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range to style \(inclusive\) |
258258
| `endIndex` | number | Yes | The end character index of the range to style \(exclusive\) |
259259
| `namedStyleType` | string | No | The named paragraph style to apply. One of: NORMAL_TEXT, TITLE, SUBTITLE, HEADING_1, HEADING_2, HEADING_3, HEADING_4, HEADING_5, HEADING_6. |
260260
| `alignment` | string | No | The paragraph alignment to apply. One of: LEFT, CENTER, RIGHT, JUSTIFY. |
@@ -279,7 +279,7 @@ Add bulleted or numbered list formatting to the paragraphs overlapping a range o
279279
| Parameter | Type | Required | Description |
280280
| --------- | ---- | -------- | ----------- |
281281
| `documentId` | string | Yes | The ID of the document to update |
282-
| `startIndex` | number | Yes | The zero-based start character index of the range to bullet \(inclusive\) |
282+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range to bullet \(inclusive\) |
283283
| `endIndex` | number | Yes | The end character index of the range to bullet \(exclusive\) |
284284
| `bulletPreset` | string | No | The bullet glyph preset to apply. Defaults to BULLET_DISC_CIRCLE_SQUARE. Examples: BULLET_DISC_CIRCLE_SQUARE, BULLET_CHECKBOX, NUMBERED_DECIMAL_ALPHA_ROMAN, NUMBERED_DECIMAL_NESTED. |
285285

@@ -303,7 +303,7 @@ Remove bullet or numbered list formatting from the paragraphs overlapping a rang
303303
| Parameter | Type | Required | Description |
304304
| --------- | ---- | -------- | ----------- |
305305
| `documentId` | string | Yes | The ID of the document to update |
306-
| `startIndex` | number | Yes | The zero-based start character index of the range to clear bullets from \(inclusive\) |
306+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range to clear bullets from \(inclusive\) |
307307
| `endIndex` | number | Yes | The end character index of the range to clear bullets from \(exclusive\) |
308308

309309
#### Output
@@ -326,7 +326,7 @@ Delete all content between a start and end character index in a Google Docs docu
326326
| Parameter | Type | Required | Description |
327327
| --------- | ---- | -------- | ----------- |
328328
| `documentId` | string | Yes | The ID of the document to delete content from |
329-
| `startIndex` | number | Yes | The zero-based start character index of the range to delete \(inclusive\) |
329+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range to delete \(inclusive\) |
330330
| `endIndex` | number | Yes | The end character index of the range to delete \(exclusive\) |
331331

332332
#### Output
@@ -350,7 +350,7 @@ Create a named range over a span of content in a Google Docs document so it can
350350
| --------- | ---- | -------- | ----------- |
351351
| `documentId` | string | Yes | The ID of the document to update |
352352
| `name` | string | Yes | The name of the range to create \(1-256 characters\) |
353-
| `startIndex` | number | Yes | The zero-based start character index of the range \(inclusive\) |
353+
| `startIndex` | number | Yes | The start character index \(the document body starts at index 1\) of the range \(inclusive\) |
354354
| `endIndex` | number | Yes | The end character index of the range \(exclusive\) |
355355

356356
#### Output

apps/sim/tools/context_dev/search.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ export const contextDevSearchTool: ToolConfig<ContextDevSearchParams, ContextDev
9494
body.numResults = Math.min(100, Math.max(10, requested))
9595
}
9696
}
97-
if (params.country) body.country = String(params.country).trim().toUpperCase()
97+
if (params.country) {
98+
const country = String(params.country).trim().toUpperCase()
99+
if (!/^[A-Z]{2}$/.test(country)) {
100+
throw new Error('country must be a 2-letter ISO 3166-1 alpha-2 code (e.g., US)')
101+
}
102+
body.country = country
103+
}
98104
if (params.queryFanout != null) body.queryFanout = params.queryFanout
99105
if (params.markdownEnabled != null) {
100106
body.markdownOptions = { enabled: params.markdownEnabled }

0 commit comments

Comments
 (0)