Skip to content

Commit 48fbdfd

Browse files
committed
fix(ahrefs): default optional country to us consistently across all tools
paid_pages, metrics_history, keywords_history, and batch_analysis were the only 4 of the 11 tools with an optional country param that didn't fall back to "us" when omitted, unlike domain_rating, metrics, keyword_overview, organic_keywords, organic_competitors, top_pages, and related_terms - all of which default client-side. Aligned all four to the same convention so direct tool/agent calls without an explicit country get the same behavior regardless of which operation is used.
1 parent 8a745ba commit 48fbdfd

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Get a target domain's pages that receive paid search traffic, sorted by estimate
302302
| Parameter | Type | Required | Description |
303303
| --------- | ---- | -------- | ----------- |
304304
| `target` | string | Yes | The target domain or URL to analyze. Example: "example.com" |
305-
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" |
305+
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" \(default: "us"\) |
306306
| `mode` | string | No | Analysis mode: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\), exact \(exact URL match\) |
307307
| `date` | string | No | Date to report metrics on, in YYYY-MM-DD format \(defaults to today\) |
308308
| `limit` | number | No | Maximum number of results to return. Example: 50 \(default: 1000\) |
@@ -410,7 +410,7 @@ Get the historical organic and paid traffic trend for a target domain or URL ove
410410
| `dateTo` | string | No | End date of the historical period, in YYYY-MM-DD format \(defaults to today\) |
411411
| `volumeMode` | string | No | Search volume calculation: "monthly" or "average" \(default: "monthly"\) |
412412
| `historyGrouping` | string | No | Time interval for grouping data points: "daily", "weekly", or "monthly" \(default: "monthly"\) |
413-
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" |
413+
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" \(default: "us"\) |
414414
| `mode` | string | No | Analysis mode: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\), exact \(exact URL match\) |
415415
| `apiKey` | string | Yes | Ahrefs API Key |
416416

@@ -460,7 +460,7 @@ Get the historical organic keyword ranking distribution for a target domain or U
460460
| `dateFrom` | string | Yes | Start date of the historical period, in YYYY-MM-DD format |
461461
| `dateTo` | string | No | End date of the historical period, in YYYY-MM-DD format \(defaults to today\) |
462462
| `historyGrouping` | string | No | Time interval for grouping data points: "daily", "weekly", or "monthly" \(default: "monthly"\) |
463-
| `country` | string | No | Country code for search results. Example: "us", "gb", "de" |
463+
| `country` | string | No | Country code for search results. Example: "us", "gb", "de" \(default: "us"\) |
464464
| `mode` | string | No | Analysis mode: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\), exact \(exact URL match\) |
465465
| `apiKey` | string | Yes | Ahrefs API Key |
466466

@@ -487,7 +487,7 @@ Get bulk SEO metrics (Domain Rating, backlinks, referring domains, organic traff
487487
| `targets` | string | Yes | Comma-separated list of domains or URLs to analyze. Example: "example.com,competitor.com" |
488488
| `mode` | string | No | Analysis mode applied to every target: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\), exact \(exact URL match\) |
489489
| `protocol` | string | No | Protocol applied to every target: "both" \(default\), "http", or "https" |
490-
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" |
490+
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" \(default: "us"\) |
491491
| `volumeMode` | string | No | Search volume calculation: "monthly" or "average" \(default: "monthly"\) |
492492
| `apiKey` | string | Yes | Ahrefs API Key |
493493

apps/sim/tools/ahrefs/batch_analysis.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const batchAnalysisTool: ToolConfig<AhrefsBatchAnalysisParams, AhrefsBatc
3737
type: 'string',
3838
required: false,
3939
visibility: 'user-or-llm',
40-
description: 'Country code for traffic data. Example: "us", "gb", "de"',
40+
description: 'Country code for traffic data. Example: "us", "gb", "de" (default: "us")',
4141
},
4242
volumeMode: {
4343
type: 'string',
@@ -75,7 +75,7 @@ export const batchAnalysisTool: ToolConfig<AhrefsBatchAnalysisParams, AhrefsBatc
7575
return {
7676
select: SELECT_FIELDS.split(','),
7777
targets,
78-
...(params.country ? { country: params.country } : {}),
78+
country: params.country || 'us',
7979
volume_mode: params.volumeMode || 'monthly',
8080
}
8181
},

apps/sim/tools/ahrefs/keywords_history.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const keywordsHistoryTool: ToolConfig<
4646
type: 'string',
4747
required: false,
4848
visibility: 'user-or-llm',
49-
description: 'Country code for search results. Example: "us", "gb", "de"',
49+
description: 'Country code for search results. Example: "us", "gb", "de" (default: "us")',
5050
},
5151
mode: {
5252
type: 'string',
@@ -71,7 +71,7 @@ export const keywordsHistoryTool: ToolConfig<
7171
url.searchParams.set('select', SELECT_FIELDS)
7272
if (params.historyGrouping) url.searchParams.set('history_grouping', params.historyGrouping)
7373
if (params.dateTo) url.searchParams.set('date_to', params.dateTo)
74-
if (params.country) url.searchParams.set('country', params.country)
74+
url.searchParams.set('country', params.country || 'us')
7575
if (params.mode) url.searchParams.set('mode', params.mode)
7676
return url.toString()
7777
},

apps/sim/tools/ahrefs/metrics_history.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const metricsHistoryTool: ToolConfig<
4949
type: 'string',
5050
required: false,
5151
visibility: 'user-or-llm',
52-
description: 'Country code for traffic data. Example: "us", "gb", "de"',
52+
description: 'Country code for traffic data. Example: "us", "gb", "de" (default: "us")',
5353
},
5454
mode: {
5555
type: 'string',
@@ -75,7 +75,7 @@ export const metricsHistoryTool: ToolConfig<
7575
url.searchParams.set('select', SELECT_FIELDS)
7676
url.searchParams.set('volume_mode', params.volumeMode || 'monthly')
7777
if (params.historyGrouping) url.searchParams.set('history_grouping', params.historyGrouping)
78-
if (params.country) url.searchParams.set('country', params.country)
78+
url.searchParams.set('country', params.country || 'us')
7979
if (params.mode) url.searchParams.set('mode', params.mode)
8080
return url.toString()
8181
},

apps/sim/tools/ahrefs/paid_pages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const paidPagesTool: ToolConfig<AhrefsPaidPagesParams, AhrefsPaidPagesRes
2121
type: 'string',
2222
required: false,
2323
visibility: 'user-or-llm',
24-
description: 'Country code for traffic data. Example: "us", "gb", "de"',
24+
description: 'Country code for traffic data. Example: "us", "gb", "de" (default: "us")',
2525
},
2626
mode: {
2727
type: 'string',
@@ -58,7 +58,7 @@ export const paidPagesTool: ToolConfig<AhrefsPaidPagesParams, AhrefsPaidPagesRes
5858
// Date is required - default to today if not provided
5959
const date = params.date || new Date().toISOString().split('T')[0]
6060
url.searchParams.set('date', date)
61-
if (params.country) url.searchParams.set('country', params.country)
61+
url.searchParams.set('country', params.country || 'us')
6262
if (params.mode) url.searchParams.set('mode', params.mode)
6363
if (params.limit) url.searchParams.set('limit', String(params.limit))
6464
return url.toString()

0 commit comments

Comments
 (0)