-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat(rest-countries): REST Countries integration #4603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mesrefoglu
wants to merge
63
commits into
simstudioai:staging
Choose a base branch
from
mesrefoglu:feat/rest-countries-integration
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
0b9019d
v0.6.23: MCP fixes, remove local state in favor of server state, moth…
waleedlatif1 a54dcbe
v0.6.24: copilot feedback wiring, captcha fixes
waleedlatif1 28af223
v0.6.25: cloudwatch, cloudformation, live kb sync, linear fixes, post…
waleedlatif1 d889f32
v0.6.26: ui improvements, multiple response blocks, docx previews, ol…
waleedlatif1 316bc8c
v0.6.27: new triggers, mothership improvements, files archive, queuei…
waleedlatif1 3f508e4
v0.6.28: new docs, delete confirmation standardization, dagster integ…
waleedlatif1 d6ec115
v0.6.29: login improvements, posthog telemetry (#4026)
TheodoreSpeaks d7da35b
v0.6.30: slack trigger enhancements, connectors performance improveme…
waleedlatif1 cf233bb
v0.6.31: elevenlabs voice, trigger.dev fixes, cloud whitelabeling for…
waleedlatif1 f8f3758
v0.6.32: BYOK fixes, ui improvements, cloudwatch tools, jsm tools ext…
waleedlatif1 3c8bb40
v0.6.33: polling improvements, jsm forms tools, credentials reactquer…
waleedlatif1 d33acf4
v0.6.34: trigger.dev fixes, CI speedup, atlassian error extractor
waleedlatif1 4f40c4c
v0.6.35: additional jira fields, HITL docs, logs cleanup efficiency
waleedlatif1 cbfab1c
v0.6.36: new chunkers, sockets state machine, google sheets/drive/cal…
waleedlatif1 4309d06
v0.6.37: audit logs page, isolated-vm worker rotation, permission gro…
waleedlatif1 8b57476
v0.6.38: models page
waleedlatif1 e3d0e74
v0.6.39: billing fixes, tools audit, landing fix
waleedlatif1 0ac0539
v0.6.40: mothership tool loop, new skills, agiloft, STS, IAM integrat…
waleedlatif1 3838b6e
v0.6.41: webhooks fix, workers removal
waleedlatif1 fc07922
v0.6.42: mothership nested file reads, search modal improvements
waleedlatif1 3a1b1a8
v0.6.43: mothership billing idempotency, env var resolution fixes
waleedlatif1 46ffc49
v0.6.44: streamdown, mothership intelligence, excel extension
waleedlatif1 010435c
v0.6.45: superagent, csp, brightdata integration, gemini response for…
Sg312 c0bc62c
Merge pull request #4190 from simstudioai/staging
icecrasher321 387cc97
v0.6.46: mothership queueing, web vitals
waleedlatif1 2dbc7fd
v0.6.47: files focusing, documentation, opus 4.7
waleedlatif1 8a50f18
v0.6.48: import csv into tables, subflow fixes, CSP updates
waleedlatif1 dcf3302
v0.6.49: deploy sockets event, resolver, logs improvements, monday.co…
waleedlatif1 bc09865
v0.6.50: ppt/doc/pdf worker isolation, docs, chat, sidebar improvements
icecrasher321 5f56e46
v0.6.51: tables improvements, billing fixes, 404 pages, code hygiene
waleedlatif1 ca3bbf1
v0.6.52: data retention, docs updates, slack manifest generator, secu…
waleedlatif1 bbf400f
v0.6.53: permissions groups migration, docs updates
waleedlatif1 7c619e7
Merge pull request #4261 from simstudioai/staging
icecrasher321 64cfda5
v0.6.54: mothership tracing, db pool size increase
icecrasher321 7ca736a
v0.6.55: standardize monorepo conventions, api key hash, thinking tex…
waleedlatif1 6066fc1
v0.6.56: data retention improvements, tables column double click resi…
waleedlatif1 3422f64
Merge pull request #4285 from simstudioai/staging
waleedlatif1 595c4c3
Merge pull request #4293 from simstudioai/staging
TheodoreSpeaks d6c1bc2
v0.6.58: queue abort state machine improvement, contributing guide
icecrasher321 58a3ae2
v0.6.59: gpt 5.5, security hardening, parallel subagents rendering
icecrasher321 489f2d3
v0.6.60: copilot security improvements, slack canvas ops, retention j…
icecrasher321 6aa3fe3
v0.6.61: SAP integration, live URLs for browser use, 5xx error catego…
icecrasher321 ecbf5e5
Merge pull request #4342 from simstudioai/staging
TheodoreSpeaks 2aaf2b7
v0.6.62: firecrawl parse, new gmail tools, trace improvements, tool f…
waleedlatif1 d445b9c
v0.6.63: knowledgebase UI, folder search in mothership
waleedlatif1 4bc6a17
v0.6.64: table limits env vars, workspace files improvements, integra…
waleedlatif1 5be12f8
v0.6.65: memory fix, image uploads in files
waleedlatif1 4253e57
v0.6.66: child trace spans, reranker controls, attachment previews, l…
waleedlatif1 8d6b615
v0.6.67: VFS upload fix, posthog/copilot correlation, exa date filter…
TheodoreSpeaks efcd51a
v0.6.68: atlassian service accounts, 30 day wait block, markdown rend…
waleedlatif1 8d934f3
v0.6.69: security hardening, nextjs upgrade, SAP Concur, Emailbison i…
waleedlatif1 5ea80a8
v0.6.70: legacy workflow sanitization
icecrasher321 3cc581e
v0.6.71: build error fix
icecrasher321 273e608
Merge pull request #4496 from simstudioai/staging
TheodoreSpeaks 07b8f1b
v0.6.72: tables improvements, search and replace, logs with files, im…
waleedlatif1 dcaf3e9
v0.6.73: zustand v5 migration fix
icecrasher321 6aeb981
v0.6.74: security hardening, workers recycling, next-mdx-remote and o…
waleedlatif1 3e9849b
v0.6.75: scheduler claim-budget drain, helm chart hardening, mothersh…
TheodoreSpeaks 64d855a
v0.6.76: helm updates, media centering, lazy loading, security hardening
waleedlatif1 ab156b5
v0.6.77: mothership improvements, trigger.dev telemetry
icecrasher321 c09a2c9
v0.6.78: file block get
Sg312 6a5eebc
v0.6.79: rate limits, tables checkboxes, drizzle config changes, bill…
waleedlatif1 f886470
rest countries integration
mesrefoglu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,7 @@ | |
| "redis", | ||
| "reducto", | ||
| "resend", | ||
| "restcountries", | ||
| "revenuecat", | ||
| "rippling", | ||
| "rootly", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| --- | ||
| title: REST Countries | ||
| description: Look up country reference data | ||
| --- | ||
|
|
||
| import { BlockInfoCard } from "@/components/ui/block-info-card" | ||
|
|
||
| <BlockInfoCard | ||
| type="restcountries" | ||
| color="#E8F2FF" | ||
| /> | ||
|
|
||
| ## Usage Instructions | ||
|
|
||
| Look up country information using the REST Countries API. Search by name, code, region, currency, or language. Does not require OAuth or an API key. | ||
|
|
||
|
|
||
|
|
||
| ## Tools | ||
|
|
||
| ### `restcountries_search_by_name` | ||
|
|
||
| Search for countries by common or official country name using the REST Countries API. | ||
|
|
||
| #### Input | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `name` | string | Yes | Country name to search for, such as "Canada" or "Republic of Korea" | | ||
| | `fullText` | boolean | No | Require an exact full-name match when true | | ||
|
|
||
| #### Output | ||
|
|
||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `countries` | json | Countries matching the name search | | ||
| | `count` | number | Number of countries returned | | ||
| | `firstCountry` | json | First matching country, or null when there are no matches | | ||
|
|
||
| ### `restcountries_get_by_code` | ||
|
|
||
| Get country information by ISO 3166-1 alpha-2, alpha-3, numeric, or IOC country code. | ||
|
|
||
| #### Input | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `code` | string | Yes | Country code, such as "US", "USA", "840", or "CAN" | | ||
|
|
||
| #### Output | ||
|
|
||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `countries` | json | Array containing the country matching the provided code | | ||
| | `count` | number | Number of countries returned | | ||
| | `firstCountry` | json | The matching country, or null when there is no match | | ||
|
|
||
| ### `restcountries_list_by_region` | ||
|
|
||
| List countries in a world region using the REST Countries API. | ||
|
|
||
| #### Input | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `region` | string | Yes | Region name, such as "Africa", "Americas", "Asia", "Europe", or "Oceania" | | ||
|
|
||
| #### Output | ||
|
|
||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `countries` | json | Countries in the requested region | | ||
| | `count` | number | Number of countries returned | | ||
| | `firstCountry` | json | First country in the returned list, or null when there are no matches | | ||
|
|
||
| ### `restcountries_list_by_currency` | ||
|
|
||
| List countries by currency code or currency name using the REST Countries API. | ||
|
|
||
| #### Input | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `currency` | string | Yes | Currency code or name, such as "USD", "EUR", or "dollar" | | ||
|
|
||
| #### Output | ||
|
|
||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `countries` | json | Countries using the requested currency | | ||
| | `count` | number | Number of countries returned | | ||
| | `firstCountry` | json | First country in the returned list, or null when there are no matches | | ||
|
|
||
| ### `restcountries_list_by_language` | ||
|
|
||
| List countries by official language code or language name using REST Countries. | ||
|
|
||
| #### Input | ||
|
|
||
| | Parameter | Type | Required | Description | | ||
| | --------- | ---- | -------- | ----------- | | ||
| | `language` | string | Yes | Language code or name, such as "en", "Spanish", or "French" | | ||
|
|
||
| #### Output | ||
|
|
||
| | Parameter | Type | Description | | ||
| | --------- | ---- | ----------- | | ||
| | `countries` | json | Countries using the requested language | | ||
| | `count` | number | Number of countries returned | | ||
| | `firstCountry` | json | First country in the returned list, or null when there are no matches | | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| import { RestCountriesIcon } from '@/components/icons' | ||
| import { type BlockConfig, IntegrationType } from '@/blocks/types' | ||
| import type { RestCountriesResponse } from '@/tools/restcountries/types' | ||
|
|
||
| export const RestCountriesBlock: BlockConfig<RestCountriesResponse> = { | ||
| type: 'restcountries', | ||
| name: 'REST Countries', | ||
| description: 'Look up country reference data', | ||
| longDescription: | ||
| 'Look up country information using the REST Countries API. Search by name, code, region, currency, or language. Does not require OAuth or an API key.', | ||
| docsLink: 'https://docs.sim.ai/tools/restcountries', | ||
| category: 'tools', | ||
| integrationType: IntegrationType.Analytics, | ||
| tags: ['data-analytics', 'knowledge-base'], | ||
| bgColor: '#E8F2FF', | ||
| icon: RestCountriesIcon, | ||
| subBlocks: [ | ||
| { | ||
| id: 'operation', | ||
| title: 'Operation', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Search by Name', id: 'restcountries_search_by_name' }, | ||
| { label: 'Get by Code', id: 'restcountries_get_by_code' }, | ||
| { label: 'List by Region', id: 'restcountries_list_by_region' }, | ||
| { label: 'List by Currency', id: 'restcountries_list_by_currency' }, | ||
| { label: 'List by Language', id: 'restcountries_list_by_language' }, | ||
| ], | ||
| value: () => 'restcountries_search_by_name', | ||
| }, | ||
| { | ||
| id: 'name', | ||
| title: 'Country Name', | ||
| type: 'short-input', | ||
| placeholder: 'Canada', | ||
| condition: { field: 'operation', value: 'restcountries_search_by_name' }, | ||
| required: { field: 'operation', value: 'restcountries_search_by_name' }, | ||
| }, | ||
| { | ||
| id: 'fullText', | ||
| title: 'Exact Match', | ||
| type: 'switch', | ||
| condition: { field: 'operation', value: 'restcountries_search_by_name' }, | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'code', | ||
| title: 'Country Code', | ||
| type: 'short-input', | ||
| placeholder: 'US, USA, 840', | ||
| condition: { field: 'operation', value: 'restcountries_get_by_code' }, | ||
| required: { field: 'operation', value: 'restcountries_get_by_code' }, | ||
| }, | ||
| { | ||
| id: 'region', | ||
| title: 'Region', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Africa', id: 'Africa' }, | ||
| { label: 'Americas', id: 'Americas' }, | ||
| { label: 'Asia', id: 'Asia' }, | ||
| { label: 'Europe', id: 'Europe' }, | ||
| { label: 'Oceania', id: 'Oceania' }, | ||
| ], | ||
| value: () => 'Europe', | ||
| condition: { field: 'operation', value: 'restcountries_list_by_region' }, | ||
| required: { field: 'operation', value: 'restcountries_list_by_region' }, | ||
| }, | ||
| { | ||
| id: 'currency', | ||
| title: 'Currency', | ||
| type: 'short-input', | ||
| placeholder: 'USD, EUR, dollar', | ||
| condition: { field: 'operation', value: 'restcountries_list_by_currency' }, | ||
| required: { field: 'operation', value: 'restcountries_list_by_currency' }, | ||
| }, | ||
| { | ||
| id: 'language', | ||
| title: 'Language', | ||
| type: 'short-input', | ||
| placeholder: 'English, Spanish, en', | ||
| condition: { field: 'operation', value: 'restcountries_list_by_language' }, | ||
| required: { field: 'operation', value: 'restcountries_list_by_language' }, | ||
| }, | ||
| ], | ||
| tools: { | ||
| access: [ | ||
| 'restcountries_search_by_name', | ||
| 'restcountries_get_by_code', | ||
| 'restcountries_list_by_region', | ||
| 'restcountries_list_by_currency', | ||
| 'restcountries_list_by_language', | ||
| ], | ||
| config: { | ||
| tool: (params) => { | ||
| switch (params.operation) { | ||
| case 'restcountries_get_by_code': | ||
| return 'restcountries_get_by_code' | ||
| case 'restcountries_list_by_region': | ||
| return 'restcountries_list_by_region' | ||
| case 'restcountries_list_by_currency': | ||
| return 'restcountries_list_by_currency' | ||
| case 'restcountries_list_by_language': | ||
| return 'restcountries_list_by_language' | ||
| default: | ||
| return 'restcountries_search_by_name' | ||
| } | ||
| }, | ||
| }, | ||
| }, | ||
| inputs: { | ||
| operation: { type: 'string', description: 'Country lookup operation to perform' }, | ||
| name: { type: 'string', description: 'Country name to search for' }, | ||
| fullText: { type: 'boolean', description: 'Require an exact country-name match' }, | ||
| code: { type: 'string', description: 'Country code to look up' }, | ||
| region: { type: 'string', description: 'World region to list countries from' }, | ||
| currency: { type: 'string', description: 'Currency code or name to search for' }, | ||
| language: { type: 'string', description: 'Language code or name to search for' }, | ||
| }, | ||
| outputs: { | ||
| countries: { type: 'json', description: 'Countries returned by REST Countries' }, | ||
| count: { type: 'number', description: 'Number of countries returned' }, | ||
| firstCountry: { type: 'json', description: 'First country in the returned list' }, | ||
| }, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The REST Countries v3.1 API recognises six regions: Africa, Americas, Antarctic, Asia, Europe, and Oceania. The
regiondropdown only exposes five — "Antarctic" is missing. A user who picks "List by Region" will never be able to query Antarctic territories, and LLM-driven workflows may generate calls that return empty results. Adding{ label: 'Antarctic', id: 'Antarctic' }to the options array (and the docs table) would close the gap.