From e7c9a67194b64fb2703fb7fcd6c930670b570ad1 Mon Sep 17 00:00:00 2001 From: Waleed Date: Thu, 2 Jul 2026 10:02:36 -0700 Subject: [PATCH] fix(algolia): tighten tools.config, add geo/facet search + task-status tool; icon/color tweaks (#5356) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(algolia): fix serialization-time param mutation, add geo/facet search, task status tool - move all tools.config coercion/remapping out of tool() into a proper params() function so dynamic block references aren't destroyed before variable resolution - wire facets and getRankingInfo into the search tool so those documented outputs are actually reachable - add geo-search (aroundLatLng/aroundRadius/insideBoundingBox/insidePolygon) to search and browse_records, matching delete_by_filter - fix aroundRadius param type (string, not number, since it accepts "all") - sync batch_operations description with the real action set (delete, clear) - consolidate list_indices pagination into the shared page/hitsPerPage fields instead of duplicate listPage/listHitsPerPage - add algolia_get_task_status tool so workflows can poll a taskID instead of guessing when a write is applied - trim indexName/objectID/destination before building request URLs - add ranking-tuning and index-snapshot skills to AlgoliaBlockMeta fix(dropcontact): swap icon to the official wordmark's teal swirl mark, bgColor to match chore(grafana): bgColor to white to match brand tile convention * fix(algolia): register subblock-id migration for listPage/listHitsPerPage CI's subblock-id stability check correctly flagged that consolidating list_indices pagination into the shared page/hitsPerPage fields would silently drop values from already-deployed workflows. Add the rename mapping so existing saved state migrates instead of being lost. * fix(algolia): remove fabricated pendingTask field from get_task_status Algolia's Get Task Status response (additionalProperties: false) only returns `status` (published | notPublished) — pendingTask belongs to the List Indices response, not this endpoint. Drop it from the tool's output, response type, and block outputs rather than inventing data. * fix(algolia): coerce getRankingInfo/createIfNotExists/forwardToReplicas from real booleans, not just strings A wired boolean (e.g. true) failed the `=== 'true'` string-only checks and silently flipped to the wrong value. Add a toBool helper that accepts both the dropdown's string values and a genuine boolean passed in via a dynamic reference. fix(dropcontact): render icon with currentColor instead of hardcoded fill The new teal swirl mark's fill (#0ABA9F) matched the block's bgColor exactly, making the icon invisible on its own tile. Use currentColor and set iconColor so the shared tile-contrast logic (getTileIconColorClass) renders it white-on-teal like the rest of the brand icon system. * fix(algolia): trim indexName in request bodies, not just URL paths Greptile caught that search.ts's body-level indexName (sent inside the multi-query POST body, not URL-encoded) wasn't trimmed like every other tool's URL-path indexName. Fixed there and in get_records.ts's per-request indexName default/override, which had the same gap. * fix(algolia): route list_indices and get_task_status GETs to the -dsn read host Verified against Algolia's official JS client source (getDefaultHosts + transporter isRead = useReadTransporter || method === 'GET'): every GET request routes to the read (-dsn) host, matching the other 14 tools in this integration (get_record, get_settings, etc). Both tools were incorrectly hitting the write host. * chore(algolia): regenerate docs to drop stale pendingTask entry The get_task_status pendingTask output was removed from code in d1021292ec (fabricated field, not in Algolia's real API response) but docs weren't regenerated at the time, leaving a stale entry. Also syncs the Dropcontact icon's currentColor fill into the docs mirror. * fix(algolia): correct batch_operations body requirement wording Verified against Algolia's actual batchWriteParams schema (specs/common/schemas/Batch.yml): body is a required property on every batch request item, including index-level delete/clear actions — it isn't omittable. The tool's param description previously said to omit it; corrected to say use an empty object instead. --- apps/docs/components/icons.tsx | 14 +- .../content/docs/en/integrations/algolia.mdx | 33 ++++- .../docs/en/integrations/dropcontact.mdx | 2 +- .../content/docs/en/integrations/grafana.mdx | 2 +- apps/sim/blocks/blocks/algolia.ts | 128 ++++++++++++------ apps/sim/blocks/blocks/dropcontact.ts | 3 +- apps/sim/blocks/blocks/grafana.ts | 2 +- apps/sim/components/icons.tsx | 14 +- apps/sim/lib/integrations/integrations.json | 12 +- .../migrations/subblock-migrations.ts | 4 + apps/sim/tools/algolia/add_record.ts | 4 +- apps/sim/tools/algolia/batch_operations.ts | 4 +- apps/sim/tools/algolia/browse_records.ts | 43 +++++- apps/sim/tools/algolia/clear_records.ts | 2 +- apps/sim/tools/algolia/copy_move_index.ts | 4 +- apps/sim/tools/algolia/delete_by_filter.ts | 4 +- apps/sim/tools/algolia/delete_index.ts | 2 +- apps/sim/tools/algolia/delete_record.ts | 2 +- apps/sim/tools/algolia/get_record.ts | 2 +- apps/sim/tools/algolia/get_records.ts | 3 +- apps/sim/tools/algolia/get_settings.ts | 2 +- apps/sim/tools/algolia/get_task_status.ts | 70 ++++++++++ apps/sim/tools/algolia/index.ts | 2 + apps/sim/tools/algolia/list_indices.ts | 2 +- .../tools/algolia/partial_update_record.ts | 2 +- apps/sim/tools/algolia/search.ts | 60 +++++++- apps/sim/tools/algolia/types.ts | 22 +++ apps/sim/tools/algolia/update_settings.ts | 2 +- apps/sim/tools/registry.ts | 2 + 29 files changed, 363 insertions(+), 85 deletions(-) create mode 100644 apps/sim/tools/algolia/get_task_status.ts diff --git a/apps/docs/components/icons.tsx b/apps/docs/components/icons.tsx index 58d2124d7b..2bc753071f 100644 --- a/apps/docs/components/icons.tsx +++ b/apps/docs/components/icons.tsx @@ -7985,18 +7985,16 @@ export function LeadMagicIcon(props: SVGProps) { ) } -/** Dropcontact brand icon: teal disc with the white open-"d" contact mark. */ +/** Dropcontact brand icon: the teal swirl mark from the official wordmark. */ export function DropcontactIcon(props: SVGProps) { return ( - - + - ) } diff --git a/apps/docs/content/docs/en/integrations/algolia.mdx b/apps/docs/content/docs/en/integrations/algolia.mdx index 29c6725e6e..9d506105db 100644 --- a/apps/docs/content/docs/en/integrations/algolia.mdx +++ b/apps/docs/content/docs/en/integrations/algolia.mdx @@ -50,6 +50,12 @@ Search an Algolia index | `page` | number | No | Page number to retrieve \(default: 0\) | | `filters` | string | No | Filter string \(e.g., "category:electronics AND price < 100"\) | | `attributesToRetrieve` | string | No | Comma-separated list of attributes to retrieve | +| `facets` | string | No | Comma-separated list of facet attribute names to retrieve counts for \(use "*" for all\) | +| `getRankingInfo` | boolean | No | Whether to include detailed ranking information in each hit | +| `aroundLatLng` | string | No | Coordinates for geo-search \(e.g., "40.71,-74.01"\) | +| `aroundRadius` | string | No | Maximum radius in meters for geo-search, or "all" for unlimited | +| `insideBoundingBox` | json | No | Bounding box coordinates as \[\[lat1, lng1, lat2, lng2\]\] for geo-search | +| `insidePolygon` | json | No | Polygon coordinates as \[\[lat1, lng1, lat2, lng2, lat3, lng3, ...\]\] for geo-search | #### Output @@ -200,6 +206,10 @@ Browse and iterate over all records in an Algolia index using cursor pagination | `attributesToRetrieve` | string | No | Comma-separated list of attributes to retrieve | | `hitsPerPage` | number | No | Number of hits per page \(default: 1000, max: 1000\) | | `cursor` | string | No | Cursor from a previous browse response for pagination | +| `aroundLatLng` | string | No | Coordinates for geo-search \(e.g., "40.71,-74.01"\) | +| `aroundRadius` | string | No | Maximum radius in meters for geo-search, or "all" for unlimited | +| `insideBoundingBox` | json | No | Bounding box coordinates as \[\[lat1, lng1, lat2, lng2\]\] for geo-search | +| `insidePolygon` | json | No | Polygon coordinates as \[\[lat1, lng1, lat2, lng2, lat3, lng3, ...\]\] for geo-search | #### Output @@ -225,7 +235,7 @@ Perform batch add, update, partial update, or delete operations on records in an | `applicationId` | string | Yes | Algolia Application ID | | `apiKey` | string | Yes | Algolia Admin API Key | | `indexName` | string | Yes | Name of the Algolia index | -| `requests` | json | Yes | Array of batch operations. Each item has "action" \(addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject\) and "body" \(the record data, must include objectID for update/delete\) | +| `requests` | json | Yes | Array of batch operations. Each item has "action" \(addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, delete, clear\) and "body" \(the record data, must include objectID for update/delete; omit body for delete/clear\) | #### Output @@ -390,7 +400,7 @@ Delete all records matching a filter from an Algolia index | `numericFilters` | json | No | Array of numeric filters \(e.g., \["price > 100"\]\) | | `tagFilters` | json | No | Array of tag filters using the _tags attribute \(e.g., \["published"\]\) | | `aroundLatLng` | string | No | Coordinates for geo-search filter \(e.g., "40.71,-74.01"\) | -| `aroundRadius` | number | No | Maximum radius in meters for geo-search, or "all" for unlimited | +| `aroundRadius` | string | No | Maximum radius in meters for geo-search, or "all" for unlimited | | `insideBoundingBox` | json | No | Bounding box coordinates as \[\[lat1, lng1, lat2, lng2\]\] for geo-search filter | | `insidePolygon` | json | No | Polygon coordinates as \[\[lat1, lng1, lat2, lng2, lat3, lng3, ...\]\] for geo-search filter | @@ -401,4 +411,23 @@ Delete all records matching a filter from an Algolia index | `taskID` | number | Algolia task ID for tracking the delete-by-filter operation | | `updatedAt` | string | Timestamp when the operation was performed | +### `algolia_get_task_status` + +Check whether an Algolia indexing task has finished publishing + +#### Input + +| Parameter | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `applicationId` | string | Yes | Algolia Application ID | +| `apiKey` | string | Yes | Algolia API Key | +| `indexName` | string | Yes | Name of the Algolia index the task ran against | +| `taskID` | number | Yes | The taskID returned by a previous write operation | + +#### Output + +| Parameter | Type | Description | +| --------- | ---- | ----------- | +| `status` | string | Task status: "published" once the operation has been applied, "notPublished" while still pending | + diff --git a/apps/docs/content/docs/en/integrations/dropcontact.mdx b/apps/docs/content/docs/en/integrations/dropcontact.mdx index 1f5cf1c8f2..b4ec2126cb 100644 --- a/apps/docs/content/docs/en/integrations/dropcontact.mdx +++ b/apps/docs/content/docs/en/integrations/dropcontact.mdx @@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card" {/* MANUAL-CONTENT-START:intro */} diff --git a/apps/docs/content/docs/en/integrations/grafana.mdx b/apps/docs/content/docs/en/integrations/grafana.mdx index 103d69dc26..5bb28062b2 100644 --- a/apps/docs/content/docs/en/integrations/grafana.mdx +++ b/apps/docs/content/docs/en/integrations/grafana.mdx @@ -7,7 +7,7 @@ import { BlockInfoCard } from "@/components/ui/block-info-card" {/* MANUAL-CONTENT-START:intro */} diff --git a/apps/sim/blocks/blocks/algolia.ts b/apps/sim/blocks/blocks/algolia.ts index be4edae15f..7b62fa540b 100644 --- a/apps/sim/blocks/blocks/algolia.ts +++ b/apps/sim/blocks/blocks/algolia.ts @@ -37,6 +37,7 @@ export const AlgoliaBlock: BlockConfig = { { label: 'Copy/Move Index', id: 'copy_move_index' }, { label: 'Clear Records', id: 'clear_records' }, { label: 'Delete By Filter', id: 'delete_by_filter' }, + { label: 'Get Task Status', id: 'get_task_status' }, ], value: () => 'search', }, @@ -63,7 +64,7 @@ export const AlgoliaBlock: BlockConfig = { title: 'Hits Per Page', type: 'short-input', placeholder: '20', - condition: { field: 'operation', value: ['search', 'browse_records'] }, + condition: { field: 'operation', value: ['search', 'browse_records', 'list_indices'] }, mode: 'advanced', }, { @@ -71,7 +72,7 @@ export const AlgoliaBlock: BlockConfig = { title: 'Page', type: 'short-input', placeholder: '0', - condition: { field: 'operation', value: 'search' }, + condition: { field: 'operation', value: ['search', 'list_indices'] }, mode: 'advanced', }, { @@ -108,6 +109,26 @@ Return ONLY the filter string, no quotes or explanation.`, condition: { field: 'operation', value: ['search', 'get_record', 'browse_records'] }, mode: 'advanced', }, + { + id: 'facets', + title: 'Facets', + type: 'short-input', + placeholder: 'category,brand (or * for all)', + condition: { field: 'operation', value: 'search' }, + mode: 'advanced', + }, + { + id: 'getRankingInfo', + title: 'Include Ranking Info', + type: 'dropdown', + options: [ + { label: 'No', id: 'false' }, + { label: 'Yes', id: 'true' }, + ], + value: () => 'false', + condition: { field: 'operation', value: 'search' }, + mode: 'advanced', + }, // Browse cursor { id: 'cursor', @@ -389,7 +410,7 @@ Return ONLY the filter string, no quotes or explanation.`, title: 'Around Lat/Lng', type: 'short-input', placeholder: '40.71,-74.01', - condition: { field: 'operation', value: 'delete_by_filter' }, + condition: { field: 'operation', value: ['delete_by_filter', 'search', 'browse_records'] }, mode: 'advanced', }, { @@ -397,7 +418,7 @@ Return ONLY the filter string, no quotes or explanation.`, title: 'Around Radius (m)', type: 'short-input', placeholder: '1000 or "all"', - condition: { field: 'operation', value: 'delete_by_filter' }, + condition: { field: 'operation', value: ['delete_by_filter', 'search', 'browse_records'] }, mode: 'advanced', }, { @@ -405,7 +426,7 @@ Return ONLY the filter string, no quotes or explanation.`, title: 'Inside Bounding Box', type: 'short-input', placeholder: '[[47.3165,0.757,47.3424,0.8012]]', - condition: { field: 'operation', value: 'delete_by_filter' }, + condition: { field: 'operation', value: ['delete_by_filter', 'search', 'browse_records'] }, mode: 'advanced', }, { @@ -413,7 +434,7 @@ Return ONLY the filter string, no quotes or explanation.`, title: 'Inside Polygon', type: 'short-input', placeholder: '[[47.3165,0.757,47.3424,0.8012,47.33,0.78]]', - condition: { field: 'operation', value: 'delete_by_filter' }, + condition: { field: 'operation', value: ['delete_by_filter', 'search', 'browse_records'] }, mode: 'advanced', }, // Get records (batch) field @@ -447,22 +468,14 @@ Return ONLY the JSON array.`, generationType: 'json-object', }, }, - // List indices pagination + // Get task status field { - id: 'listPage', - title: 'Page', + id: 'taskID', + title: 'Task ID', type: 'short-input', - placeholder: '0', - condition: { field: 'operation', value: 'list_indices' }, - mode: 'advanced', - }, - { - id: 'listHitsPerPage', - title: 'Indices Per Page', - type: 'short-input', - placeholder: '100', - condition: { field: 'operation', value: 'list_indices' }, - mode: 'advanced', + placeholder: '12345', + condition: { field: 'operation', value: 'get_task_status' }, + required: { field: 'operation', value: 'get_task_status' }, }, // Object ID - for add (optional), get, partial update, delete { @@ -515,32 +528,48 @@ Return ONLY the JSON array.`, 'algolia_copy_move_index', 'algolia_clear_records', 'algolia_delete_by_filter', + 'algolia_get_task_status', ], config: { - tool: (params: Record) => { - const op = params.operation as string - if (op === 'partial_update_record') { - params.createIfNotExists = params.createIfNotExists !== 'false' + tool: (params: Record) => `algolia_${params.operation}`, + params: (params: Record) => { + const { operation, ...rest } = params + const result: Record = {} + + for (const [key, value] of Object.entries(rest)) { + if (value === undefined || value === null || value === '') continue + result[key] = value } - if (op === 'update_settings' && params.forwardToReplicas === 'true') { - params.forwardToReplicas = true - } else if (op === 'update_settings') { - params.forwardToReplicas = false + + const toBool = (value: unknown, defaultValue: boolean) => { + if (typeof value === 'boolean') return value + if (typeof value === 'string') return value === 'true' + return defaultValue } - if (op === 'copy_move_index') { - params.operation = params.copyMoveOperation + + if (operation === 'partial_update_record') { + result.createIfNotExists = toBool(result.createIfNotExists, true) } - if (op === 'delete_by_filter') { - params.filters = params.deleteFilters + if (operation === 'update_settings') { + result.forwardToReplicas = toBool(result.forwardToReplicas, false) } - if (op === 'get_records') { - params.requests = params.getRecordsRequests + if (operation === 'search' && result.getRankingInfo !== undefined) { + result.getRankingInfo = toBool(result.getRankingInfo, false) } - if (op === 'list_indices') { - if (params.listPage !== undefined) params.page = params.listPage - if (params.listHitsPerPage !== undefined) params.hitsPerPage = params.listHitsPerPage + if (operation === 'copy_move_index') { + result.operation = result.copyMoveOperation + result.copyMoveOperation = undefined } - return `algolia_${op}` + if (operation === 'delete_by_filter') { + result.filters = result.deleteFilters + result.deleteFilters = undefined + } + if (operation === 'get_records') { + result.requests = result.getRecordsRequests + result.getRecordsRequests = undefined + } + + return result }, }, }, @@ -553,6 +582,8 @@ Return ONLY the JSON array.`, page: { type: 'string', description: 'Page number' }, filters: { type: 'string', description: 'Algolia filter string' }, attributesToRetrieve: { type: 'string', description: 'Attributes to retrieve' }, + facets: { type: 'string', description: 'Comma-separated facet attribute names to count' }, + getRankingInfo: { type: 'string', description: 'Include detailed ranking info in each hit' }, cursor: { type: 'string', description: 'Browse cursor for pagination' }, record: { type: 'json', description: 'Record data to add' }, attributes: { type: 'json', description: 'Attributes to partially update' }, @@ -579,8 +610,7 @@ Return ONLY the JSON array.`, type: 'json', description: 'Array of objects with objectID to retrieve multiple records', }, - listPage: { type: 'string', description: 'Page number for list indices pagination' }, - listHitsPerPage: { type: 'string', description: 'Indices per page for list indices' }, + taskID: { type: 'string', description: 'Task ID returned by a previous write operation' }, applicationId: { type: 'string', description: 'Algolia Application ID' }, apiKey: { type: 'string', description: 'Algolia API Key' }, }, @@ -644,6 +674,10 @@ Return ONLY the JSON array.`, type: 'number', description: 'Maximum number of hits accessible via pagination (default 1000)', }, + status: { + type: 'string', + description: 'Task status: "published" once applied, "notPublished" while still pending', + }, }, } @@ -739,5 +773,19 @@ export const AlgoliaBlockMeta = { content: '# Audit Search Relevance\n\nCheck that important queries return good results from an Algolia index.\n\n## Steps\n1. Run each query in the provided test set against the index.\n2. Record the top results, total hit count, and whether the expected record appears.\n3. Flag queries that return zero hits, too many hits, or miss the expected record.\n\n## Output\nA table of queries with result counts and pass/fail, plus suggestions for synonyms or ranking tweaks where relevance is weak.', }, + { + name: 'tune-index-ranking', + description: + 'Read an Algolia index configuration, propose ranking and searchable-attribute changes, and apply the update.', + content: + '# Tune Index Ranking\n\nAdjust how an Algolia index ranks results without touching the underlying data.\n\n## Steps\n1. Fetch the current index settings (searchable attributes, custom ranking, ranking criteria).\n2. Compare them against the desired outcome (e.g., surface newer or more popular items first).\n3. Propose specific changes to customRanking, searchableAttributes order, or attributesForFaceting.\n4. Apply the approved settings update to the index.\n\n## Output\nA before/after summary of the settings changed and why, plus confirmation the update succeeded.', + }, + { + name: 'snapshot-index-before-change', + description: + 'Copy an Algolia index to a timestamped backup before applying a risky settings or data change.', + content: + '# Snapshot Index Before Change\n\nProtect against a bad settings or batch update by copying the index first.\n\n## Steps\n1. Copy the source index to a new destination index named with a date or version suffix.\n2. Confirm the copy completed by checking the resulting task status.\n3. Apply the intended change (settings update, batch operation, or delete-by-filter) to the original index.\n4. If the change causes problems, the snapshot index can be copied back or used for comparison.\n\n## Output\nThe name of the backup index created and confirmation the source change was applied afterward.', + }, ], } as const satisfies BlockMeta diff --git a/apps/sim/blocks/blocks/dropcontact.ts b/apps/sim/blocks/blocks/dropcontact.ts index be4ca04a2f..d335da3726 100644 --- a/apps/sim/blocks/blocks/dropcontact.ts +++ b/apps/sim/blocks/blocks/dropcontact.ts @@ -10,7 +10,8 @@ export const DropcontactBlock: BlockConfig = { 'Use Dropcontact to verify and enrich B2B contacts. Submit a contact with their name, company, website, or LinkedIn URL and receive a verified professional email, phone number, company firmographics, and LinkedIn profile. Enrichment is async: Dropcontact processes the request, then Sim polls until the result is ready. Credits are only charged when a verified email is returned.', docsLink: 'https://docs.sim.ai/tools/dropcontact', category: 'tools', - bgColor: '#0066FF', + bgColor: '#0ABA9F', + iconColor: '#0ABA9F', icon: DropcontactIcon, authMode: AuthMode.ApiKey, integrationType: IntegrationType.Sales, diff --git a/apps/sim/blocks/blocks/grafana.ts b/apps/sim/blocks/blocks/grafana.ts index 9cb12c810c..d1c70517d6 100644 --- a/apps/sim/blocks/blocks/grafana.ts +++ b/apps/sim/blocks/blocks/grafana.ts @@ -13,7 +13,7 @@ export const GrafanaBlock: BlockConfig = { docsLink: 'https://docs.sim.ai/integrations/grafana', category: 'tools', integrationType: IntegrationType.Observability, - bgColor: '#F46800', + bgColor: '#FFFFFF', icon: GrafanaIcon, subBlocks: [ { diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index 58d2124d7b..2bc753071f 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -7985,18 +7985,16 @@ export function LeadMagicIcon(props: SVGProps) { ) } -/** Dropcontact brand icon: teal disc with the white open-"d" contact mark. */ +/** Dropcontact brand icon: the teal swirl mark from the official wordmark. */ export function DropcontactIcon(props: SVGProps) { return ( - - + - ) } diff --git a/apps/sim/lib/integrations/integrations.json b/apps/sim/lib/integrations/integrations.json index e362db3a58..03f0702983 100644 --- a/apps/sim/lib/integrations/integrations.json +++ b/apps/sim/lib/integrations/integrations.json @@ -1,5 +1,5 @@ { - "updatedAt": "2026-07-01", + "updatedAt": "2026-07-02", "integrations": [ { "type": "onepassword", @@ -541,9 +541,13 @@ { "name": "Delete By Filter", "description": "Delete all records matching a filter from an Algolia index" + }, + { + "name": "Get Task Status", + "description": "Check whether an Algolia indexing task has finished publishing" } ], - "operationCount": 15, + "operationCount": 16, "triggers": [], "triggerCount": 0, "authType": "api-key", @@ -4418,7 +4422,7 @@ "name": "Dropcontact", "description": "Enrich B2B contacts with verified email, phone, and company data", "longDescription": "Use Dropcontact to verify and enrich B2B contacts. Submit a contact with their name, company, website, or LinkedIn URL and receive a verified professional email, phone number, company firmographics, and LinkedIn profile. Enrichment is async: Dropcontact processes the request, then Sim polls until the result is ready. Credits are only charged when a verified email is returned.", - "bgColor": "#0066FF", + "bgColor": "#0ABA9F", "iconName": "DropcontactIcon", "docsUrl": "https://docs.sim.ai/tools/dropcontact", "operations": [ @@ -7312,7 +7316,7 @@ "name": "Grafana", "description": "Interact with Grafana dashboards, alerts, and annotations", "longDescription": "Integrate Grafana into workflows. Manage dashboards, alerts, annotations, data sources, folders, and monitor health status.", - "bgColor": "#F46800", + "bgColor": "#FFFFFF", "iconName": "GrafanaIcon", "docsUrl": "https://docs.sim.ai/integrations/grafana", "operations": [ diff --git a/apps/sim/lib/workflows/migrations/subblock-migrations.ts b/apps/sim/lib/workflows/migrations/subblock-migrations.ts index 3deedca521..d56d51ff05 100644 --- a/apps/sim/lib/workflows/migrations/subblock-migrations.ts +++ b/apps/sim/lib/workflows/migrations/subblock-migrations.ts @@ -26,6 +26,10 @@ export const SUBBLOCK_ID_MIGRATIONS: Record> = { knowledge: { knowledgeBaseId: 'knowledgeBaseSelector', }, + algolia: { + listPage: 'page', + listHitsPerPage: 'hitsPerPage', + }, kalshi: { settlementStatus: '_removed_settlementStatus', }, diff --git a/apps/sim/tools/algolia/add_record.ts b/apps/sim/tools/algolia/add_record.ts index a1ccb3b30c..a6f5623ac4 100644 --- a/apps/sim/tools/algolia/add_record.ts +++ b/apps/sim/tools/algolia/add_record.ts @@ -42,9 +42,9 @@ export const addRecordTool: ToolConfig { - const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}` + const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}` if (params.objectID) { - return `${base}/${encodeURIComponent(params.objectID)}` + return `${base}/${encodeURIComponent(params.objectID.trim())}` } return base }, diff --git a/apps/sim/tools/algolia/batch_operations.ts b/apps/sim/tools/algolia/batch_operations.ts index d65c69c0fe..7016dc2671 100644 --- a/apps/sim/tools/algolia/batch_operations.ts +++ b/apps/sim/tools/algolia/batch_operations.ts @@ -38,13 +38,13 @@ export const batchOperationsTool: ToolConfig< required: true, visibility: 'user-or-llm', description: - 'Array of batch operations. Each item has "action" (addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject) and "body" (the record data, must include objectID for update/delete)', + 'Array of batch operations. Each item has "action" (addObject, updateObject, partialUpdateObject, partialUpdateObjectNoCreate, deleteObject, delete, clear) and "body" (the record data; must include objectID for update/delete; use an empty object {} for the index-level delete/clear actions)', }, }, request: { url: (params) => - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/batch`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/batch`, method: 'POST', headers: (params) => ({ 'x-algolia-application-id': params.applicationId, diff --git a/apps/sim/tools/algolia/browse_records.ts b/apps/sim/tools/algolia/browse_records.ts index 7b6dc3064f..c466879fae 100644 --- a/apps/sim/tools/algolia/browse_records.ts +++ b/apps/sim/tools/algolia/browse_records.ts @@ -62,11 +62,36 @@ export const browseRecordsTool: ToolConfig< visibility: 'user-or-llm', description: 'Cursor from a previous browse response for pagination', }, + aroundLatLng: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Coordinates for geo-search (e.g., "40.71,-74.01")', + }, + aroundRadius: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Maximum radius in meters for geo-search, or "all" for unlimited', + }, + insideBoundingBox: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search', + }, + insidePolygon: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search', + }, }, request: { url: (params) => - `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/browse`, + `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/browse`, method: 'POST', headers: (params) => ({ 'x-algolia-application-id': params.applicationId, @@ -86,6 +111,22 @@ export const browseRecordsTool: ToolConfig< .map((a: string) => a.trim()) } if (params.hitsPerPage !== undefined) body.hitsPerPage = Number(params.hitsPerPage) + if (params.aroundLatLng) body.aroundLatLng = params.aroundLatLng + if (params.aroundRadius !== undefined) { + body.aroundRadius = params.aroundRadius === 'all' ? 'all' : Number(params.aroundRadius) + } + if (params.insideBoundingBox) { + body.insideBoundingBox = + typeof params.insideBoundingBox === 'string' + ? JSON.parse(params.insideBoundingBox) + : params.insideBoundingBox + } + if (params.insidePolygon) { + body.insidePolygon = + typeof params.insidePolygon === 'string' + ? JSON.parse(params.insidePolygon) + : params.insidePolygon + } return body }, }, diff --git a/apps/sim/tools/algolia/clear_records.ts b/apps/sim/tools/algolia/clear_records.ts index 1c789ea8fd..b647e3912f 100644 --- a/apps/sim/tools/algolia/clear_records.ts +++ b/apps/sim/tools/algolia/clear_records.ts @@ -32,7 +32,7 @@ export const clearRecordsTool: ToolConfig - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/clear`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/clear`, method: 'POST', headers: (params) => ({ 'x-algolia-application-id': params.applicationId, diff --git a/apps/sim/tools/algolia/copy_move_index.ts b/apps/sim/tools/algolia/copy_move_index.ts index 7174d1f991..970d18d641 100644 --- a/apps/sim/tools/algolia/copy_move_index.ts +++ b/apps/sim/tools/algolia/copy_move_index.ts @@ -55,7 +55,7 @@ export const copyMoveIndexTool: ToolConfig< request: { url: (params) => - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/operation`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/operation`, method: 'POST', headers: (params) => ({ 'x-algolia-application-id': params.applicationId, @@ -65,7 +65,7 @@ export const copyMoveIndexTool: ToolConfig< body: (params) => { const body: Record = { operation: params.operation, - destination: params.destination, + destination: params.destination.trim(), } if (params.scope) { const scope = typeof params.scope === 'string' ? JSON.parse(params.scope) : params.scope diff --git a/apps/sim/tools/algolia/delete_by_filter.ts b/apps/sim/tools/algolia/delete_by_filter.ts index ca030f07f5..b79cc0f2d8 100644 --- a/apps/sim/tools/algolia/delete_by_filter.ts +++ b/apps/sim/tools/algolia/delete_by_filter.ts @@ -63,7 +63,7 @@ export const deleteByFilterTool: ToolConfig< description: 'Coordinates for geo-search filter (e.g., "40.71,-74.01")', }, aroundRadius: { - type: 'number', + type: 'string', required: false, visibility: 'user-or-llm', description: 'Maximum radius in meters for geo-search, or "all" for unlimited', @@ -85,7 +85,7 @@ export const deleteByFilterTool: ToolConfig< request: { url: (params) => - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/deleteByQuery`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/deleteByQuery`, method: 'POST', headers: (params) => ({ 'x-algolia-application-id': params.applicationId, diff --git a/apps/sim/tools/algolia/delete_index.ts b/apps/sim/tools/algolia/delete_index.ts index 7e206aafcb..130f56ee5a 100644 --- a/apps/sim/tools/algolia/delete_index.ts +++ b/apps/sim/tools/algolia/delete_index.ts @@ -31,7 +31,7 @@ export const deleteIndexTool: ToolConfig - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}`, headers: (params) => ({ 'x-algolia-application-id': params.applicationId, 'x-algolia-api-key': params.apiKey, diff --git a/apps/sim/tools/algolia/delete_record.ts b/apps/sim/tools/algolia/delete_record.ts index db63ee7059..5332d322a6 100644 --- a/apps/sim/tools/algolia/delete_record.ts +++ b/apps/sim/tools/algolia/delete_record.ts @@ -38,7 +38,7 @@ export const deleteRecordTool: ToolConfig - `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/${encodeURIComponent(params.objectID)}`, + `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/${encodeURIComponent(params.objectID.trim())}`, headers: (params) => ({ 'x-algolia-application-id': params.applicationId, 'x-algolia-api-key': params.apiKey, diff --git a/apps/sim/tools/algolia/get_record.ts b/apps/sim/tools/algolia/get_record.ts index 88992c0feb..61aa748276 100644 --- a/apps/sim/tools/algolia/get_record.ts +++ b/apps/sim/tools/algolia/get_record.ts @@ -43,7 +43,7 @@ export const getRecordTool: ToolConfig { - const base = `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/${encodeURIComponent(params.objectID)}` + const base = `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/${encodeURIComponent(params.objectID.trim())}` if (params.attributesToRetrieve) { return `${base}?attributesToRetrieve=${encodeURIComponent(params.attributesToRetrieve)}` } diff --git a/apps/sim/tools/algolia/get_records.ts b/apps/sim/tools/algolia/get_records.ts index 15199f0a8e..4c1b2f355f 100644 --- a/apps/sim/tools/algolia/get_records.ts +++ b/apps/sim/tools/algolia/get_records.ts @@ -48,7 +48,8 @@ export const getRecordsTool: ToolConfig[]).map((req) => ({ ...req, - indexName: req.indexName ?? params.indexName, + indexName: + typeof req.indexName === 'string' ? req.indexName.trim() : params.indexName.trim(), })) return { requests } }, diff --git a/apps/sim/tools/algolia/get_settings.ts b/apps/sim/tools/algolia/get_settings.ts index 16bc90ddfd..db3b7aeebd 100644 --- a/apps/sim/tools/algolia/get_settings.ts +++ b/apps/sim/tools/algolia/get_settings.ts @@ -31,7 +31,7 @@ export const getSettingsTool: ToolConfig - `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/settings`, + `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/settings`, headers: (params) => ({ 'x-algolia-application-id': params.applicationId, 'x-algolia-api-key': params.apiKey, diff --git a/apps/sim/tools/algolia/get_task_status.ts b/apps/sim/tools/algolia/get_task_status.ts new file mode 100644 index 0000000000..c8ea30d080 --- /dev/null +++ b/apps/sim/tools/algolia/get_task_status.ts @@ -0,0 +1,70 @@ +import type { + AlgoliaGetTaskStatusParams, + AlgoliaGetTaskStatusResponse, +} from '@/tools/algolia/types' +import type { ToolConfig } from '@/tools/types' + +export const getTaskStatusTool: ToolConfig< + AlgoliaGetTaskStatusParams, + AlgoliaGetTaskStatusResponse +> = { + id: 'algolia_get_task_status', + name: 'Algolia Get Task Status', + description: 'Check whether an Algolia indexing task has finished publishing', + version: '1.0', + + params: { + applicationId: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'Algolia Application ID', + }, + apiKey: { + type: 'string', + required: true, + visibility: 'user-only', + description: 'Algolia API Key', + }, + indexName: { + type: 'string', + required: true, + visibility: 'user-or-llm', + description: 'Name of the Algolia index the task ran against', + }, + taskID: { + type: 'number', + required: true, + visibility: 'user-or-llm', + description: 'The taskID returned by a previous write operation', + }, + }, + + request: { + method: 'GET', + url: (params) => + `https://${params.applicationId}-dsn.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/task/${encodeURIComponent(String(params.taskID).trim())}`, + headers: (params) => ({ + 'x-algolia-application-id': params.applicationId, + 'x-algolia-api-key': params.apiKey, + }), + }, + + transformResponse: async (response) => { + const data = await response.json() + return { + success: true, + output: { + status: data.status ?? '', + }, + } + }, + + outputs: { + status: { + type: 'string', + description: + 'Task status: "published" once the operation has been applied, "notPublished" while still pending', + }, + }, +} diff --git a/apps/sim/tools/algolia/index.ts b/apps/sim/tools/algolia/index.ts index b5fdc4bd70..a86ac448f7 100644 --- a/apps/sim/tools/algolia/index.ts +++ b/apps/sim/tools/algolia/index.ts @@ -9,6 +9,7 @@ import { deleteRecordTool } from '@/tools/algolia/delete_record' import { getRecordTool } from '@/tools/algolia/get_record' import { getRecordsTool } from '@/tools/algolia/get_records' import { getSettingsTool } from '@/tools/algolia/get_settings' +import { getTaskStatusTool } from '@/tools/algolia/get_task_status' import { listIndicesTool } from '@/tools/algolia/list_indices' import { partialUpdateRecordTool } from '@/tools/algolia/partial_update_record' import { searchTool } from '@/tools/algolia/search' @@ -24,6 +25,7 @@ export const algoliaBrowseRecordsTool = browseRecordsTool export const algoliaBatchOperationsTool = batchOperationsTool export const algoliaListIndicesTool = listIndicesTool export const algoliaGetSettingsTool = getSettingsTool +export const algoliaGetTaskStatusTool = getTaskStatusTool export const algoliaUpdateSettingsTool = updateSettingsTool export const algoliaDeleteIndexTool = deleteIndexTool export const algoliaCopyMoveIndexTool = copyMoveIndexTool diff --git a/apps/sim/tools/algolia/list_indices.ts b/apps/sim/tools/algolia/list_indices.ts index 5e6f3d30e7..b938be2440 100644 --- a/apps/sim/tools/algolia/list_indices.ts +++ b/apps/sim/tools/algolia/list_indices.ts @@ -37,7 +37,7 @@ export const listIndicesTool: ToolConfig { - const base = `https://${params.applicationId}.algolia.net/1/indexes` + const base = `https://${params.applicationId}-dsn.algolia.net/1/indexes` const queryParams: string[] = [] if (params.page !== undefined) queryParams.push(`page=${params.page}`) if (params.hitsPerPage !== undefined) queryParams.push(`hitsPerPage=${params.hitsPerPage}`) diff --git a/apps/sim/tools/algolia/partial_update_record.ts b/apps/sim/tools/algolia/partial_update_record.ts index ce6430ecbd..80f6214c07 100644 --- a/apps/sim/tools/algolia/partial_update_record.ts +++ b/apps/sim/tools/algolia/partial_update_record.ts @@ -55,7 +55,7 @@ export const partialUpdateRecordTool: ToolConfig< request: { url: (params) => { - const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/${encodeURIComponent(params.objectID)}/partial` + const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/${encodeURIComponent(params.objectID.trim())}/partial` if (params.createIfNotExists === false) { return `${base}?createIfNotExists=false` } diff --git a/apps/sim/tools/algolia/search.ts b/apps/sim/tools/algolia/search.ts index fb46fd7dc4..f02901eeaa 100644 --- a/apps/sim/tools/algolia/search.ts +++ b/apps/sim/tools/algolia/search.ts @@ -56,6 +56,44 @@ export const searchTool: ToolConfig visibility: 'user-or-llm', description: 'Comma-separated list of attributes to retrieve', }, + facets: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: + 'Comma-separated list of facet attribute names to retrieve counts for (use "*" for all)', + }, + getRankingInfo: { + type: 'boolean', + required: false, + visibility: 'user-or-llm', + description: 'Whether to include detailed ranking information in each hit', + }, + aroundLatLng: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Coordinates for geo-search (e.g., "40.71,-74.01")', + }, + aroundRadius: { + type: 'string', + required: false, + visibility: 'user-or-llm', + description: 'Maximum radius in meters for geo-search, or "all" for unlimited', + }, + insideBoundingBox: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: 'Bounding box coordinates as [[lat1, lng1, lat2, lng2]] for geo-search', + }, + insidePolygon: { + type: 'json', + required: false, + visibility: 'user-or-llm', + description: + 'Polygon coordinates as [[lat1, lng1, lat2, lng2, lat3, lng3, ...]] for geo-search', + }, }, request: { @@ -68,7 +106,7 @@ export const searchTool: ToolConfig }), body: (params) => { const request: Record = { - indexName: params.indexName, + indexName: params.indexName.trim(), query: params.query, } if (params.hitsPerPage !== undefined) request.hitsPerPage = Number(params.hitsPerPage) @@ -79,6 +117,26 @@ export const searchTool: ToolConfig .split(',') .map((a: string) => a.trim()) } + if (params.facets) { + request.facets = params.facets.split(',').map((f: string) => f.trim()) + } + if (params.getRankingInfo) request.getRankingInfo = true + if (params.aroundLatLng) request.aroundLatLng = params.aroundLatLng + if (params.aroundRadius !== undefined) { + request.aroundRadius = params.aroundRadius === 'all' ? 'all' : Number(params.aroundRadius) + } + if (params.insideBoundingBox) { + request.insideBoundingBox = + typeof params.insideBoundingBox === 'string' + ? JSON.parse(params.insideBoundingBox) + : params.insideBoundingBox + } + if (params.insidePolygon) { + request.insidePolygon = + typeof params.insidePolygon === 'string' + ? JSON.parse(params.insidePolygon) + : params.insidePolygon + } return { requests: [request] } }, }, diff --git a/apps/sim/tools/algolia/types.ts b/apps/sim/tools/algolia/types.ts index c297871d6d..3e30293a52 100644 --- a/apps/sim/tools/algolia/types.ts +++ b/apps/sim/tools/algolia/types.ts @@ -13,6 +13,12 @@ export interface AlgoliaSearchParams extends AlgoliaBaseParams { page?: number | string filters?: string attributesToRetrieve?: string + facets?: string + getRankingInfo?: boolean | string + aroundLatLng?: string + aroundRadius?: number | string + insideBoundingBox?: string | number[][] + insidePolygon?: string | number[][] } export interface AlgoliaSearchResponse extends ToolResponse { @@ -116,6 +122,10 @@ export interface AlgoliaBrowseRecordsParams extends AlgoliaBaseParams { attributesToRetrieve?: string hitsPerPage?: number | string cursor?: string + aroundLatLng?: string + aroundRadius?: number | string + insideBoundingBox?: string | number[][] + insidePolygon?: string | number[][] } export interface AlgoliaBrowseRecordsResponse extends ToolResponse { @@ -266,3 +276,15 @@ export interface AlgoliaDeleteByFilterResponse extends ToolResponse { updatedAt: string | null } } + +// Get Task Status +export interface AlgoliaGetTaskStatusParams extends AlgoliaBaseParams { + indexName: string + taskID: number | string +} + +export interface AlgoliaGetTaskStatusResponse extends ToolResponse { + output: { + status: string + } +} diff --git a/apps/sim/tools/algolia/update_settings.ts b/apps/sim/tools/algolia/update_settings.ts index e8ff7f873a..e3c4dd367f 100644 --- a/apps/sim/tools/algolia/update_settings.ts +++ b/apps/sim/tools/algolia/update_settings.ts @@ -49,7 +49,7 @@ export const updateSettingsTool: ToolConfig< request: { url: (params) => { - const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName)}/settings` + const base = `https://${params.applicationId}.algolia.net/1/indexes/${encodeURIComponent(params.indexName.trim())}/settings` if (params.forwardToReplicas) { return `${base}?forwardToReplicas=true` } diff --git a/apps/sim/tools/registry.ts b/apps/sim/tools/registry.ts index 57683fc134..61737af4cc 100644 --- a/apps/sim/tools/registry.ts +++ b/apps/sim/tools/registry.ts @@ -103,6 +103,7 @@ import { algoliaGetRecordsTool, algoliaGetRecordTool, algoliaGetSettingsTool, + algoliaGetTaskStatusTool, algoliaListIndicesTool, algoliaPartialUpdateRecordTool, algoliaSearchTool, @@ -6651,6 +6652,7 @@ export const tools: Record = { algolia_copy_move_index: algoliaCopyMoveIndexTool, algolia_clear_records: algoliaClearRecordsTool, algolia_delete_by_filter: algoliaDeleteByFilterTool, + algolia_get_task_status: algoliaGetTaskStatusTool, airtable_create_records: airtableCreateRecordsTool, airtable_delete_records: airtableDeleteRecordsTool, airtable_get_base_schema: airtableGetBaseSchemaTool,