Skip to content

Commit 80a36f4

Browse files
committed
fix(integrations): clamp context.dev search bounds; precise Google Docs index wording
- context_dev/search: clamp numResults to the documented 10-100 range; normalize country to trimmed uppercase - google_docs: replace ambiguous '1-based'/'zero-based' index wording with the concrete fact (the document body starts at index 1), matching buildInsertLocation (index<1 appends) and buildContentRange
1 parent ad1bb6b commit 80a36f4

11 files changed

Lines changed: 23 additions & 12 deletions

apps/sim/tools/context_dev/search.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,14 @@ export const contextDevSearchTool: ToolConfig<ContextDevSearchParams, ContextDev
8787
if (params.includeDomains?.length) body.includeDomains = params.includeDomains
8888
if (params.excludeDomains?.length) body.excludeDomains = params.excludeDomains
8989
if (params.freshness) body.freshness = params.freshness
90-
if (params.numResults != null) body.numResults = params.numResults
91-
if (params.country) body.country = params.country
90+
if (params.numResults != null) {
91+
// Context.dev accepts 10-100 results — clamp to the documented bounds.
92+
const requested = Math.trunc(Number(params.numResults))
93+
if (Number.isFinite(requested)) {
94+
body.numResults = Math.min(100, Math.max(10, requested))
95+
}
96+
}
97+
if (params.country) body.country = String(params.country).trim().toUpperCase()
9298
if (params.queryFanout != null) body.queryFanout = params.queryFanout
9399
if (params.markdownEnabled != null) {
94100
body.markdownOptions = { enabled: params.markdownEnabled }

apps/sim/tools/google_docs/create-named-range.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export const createNamedRangeTool: ToolConfig<
4545
type: 'number',
4646
required: true,
4747
visibility: 'user-or-llm',
48-
description: 'The zero-based start character index of the range (inclusive)',
48+
description:
49+
'The start character index (the document body starts at index 1) of the range (inclusive)',
4950
},
5051
endIndex: {
5152
type: 'number',

apps/sim/tools/google_docs/create-paragraph-bullets.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export const createParagraphBulletsTool: ToolConfig<
5656
type: 'number',
5757
required: true,
5858
visibility: 'user-or-llm',
59-
description: 'The zero-based start character index of the range to bullet (inclusive)',
59+
description:
60+
'The start character index (the document body starts at index 1) of the range to bullet (inclusive)',
6061
},
6162
endIndex: {
6263
type: 'number',

apps/sim/tools/google_docs/delete-content-range.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export const deleteContentRangeTool: ToolConfig<
3939
type: 'number',
4040
required: true,
4141
visibility: 'user-or-llm',
42-
description: 'The zero-based start character index of the range to delete (inclusive)',
42+
description:
43+
'The start character index (the document body starts at index 1) of the range to delete (inclusive)',
4344
},
4445
endIndex: {
4546
type: 'number',

apps/sim/tools/google_docs/delete-paragraph-bullets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const deleteParagraphBulletsTool: ToolConfig<
4040
required: true,
4141
visibility: 'user-or-llm',
4242
description:
43-
'The zero-based start character index of the range to clear bullets from (inclusive)',
43+
'The start character index (the document body starts at index 1) of the range to clear bullets from (inclusive)',
4444
},
4545
endIndex: {
4646
type: 'number',

apps/sim/tools/google_docs/insert-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const insertImageTool: ToolConfig<GoogleDocsToolParams, GoogleDocsInsertI
4040
required: false,
4141
visibility: 'user-or-llm',
4242
description:
43-
'The zero-based character index at which to insert the image. When omitted, the image is appended to the end of the document.',
43+
'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.',
4444
},
4545
width: {
4646
type: 'number',

apps/sim/tools/google_docs/insert-page-break.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const insertPageBreakTool: ToolConfig<
4040
required: false,
4141
visibility: 'user-or-llm',
4242
description:
43-
'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.',
43+
'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.',
4444
},
4545
},
4646
request: {

apps/sim/tools/google_docs/insert-table.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const insertTableTool: ToolConfig<GoogleDocsToolParams, GoogleDocsInsertT
4646
required: false,
4747
visibility: 'user-or-llm',
4848
description:
49-
'The zero-based character index at which to insert the table. When omitted, the table is appended to the end of the document.',
49+
'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.',
5050
},
5151
},
5252
request: {

apps/sim/tools/google_docs/insert-text.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const insertTextTool: ToolConfig<GoogleDocsToolParams, GoogleDocsInsertTe
4040
required: false,
4141
visibility: 'user-or-llm',
4242
description:
43-
'The zero-based character index at which to insert the text. When omitted, text is appended to the end of the document.',
43+
'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.',
4444
},
4545
},
4646
request: {

apps/sim/tools/google_docs/update-paragraph-style.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export const updateParagraphStyleTool: ToolConfig<
6565
type: 'number',
6666
required: true,
6767
visibility: 'user-or-llm',
68-
description: 'The zero-based start character index of the range to style (inclusive)',
68+
description:
69+
'The start character index (the document body starts at index 1) of the range to style (inclusive)',
6970
},
7071
endIndex: {
7172
type: 'number',

0 commit comments

Comments
 (0)