Skip to content

Conversation

@aadamgough
Copy link
Collaborator

Summary

Fixed various tool outputs

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 26, 2025 8:37pm

@aadamgough aadamgough marked this pull request as ready for review December 26, 2025 19:47
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 26, 2025

Greptile Summary

This PR standardizes and improves tool output schemas across Intercom, Pinecone, Supabase, and Typeform integrations by flattening the output structure and providing detailed type definitions for better discoverability and usability.

Major Changes:

  • Intercom tools (14 files): Flattened outputs schema to expose detailed property definitions at the top level instead of generic nested objects, making contact, company, conversation, and ticket structures fully typed
  • Pinecone: Corrected upsert_text to return only statusText (Pinecone API returns 201 with empty body, not upsertedCount)
  • Supabase Storage: Improved UX by splitting path parameter into required fileName and optional path (folder), with proper URL construction logic to prevent double slashes
  • Typeform: Enhanced update_form with robust empty response handling (204/empty body) and simplified output to success message; added comprehensive AI wand configuration with JSON Patch documentation
  • Salesforce OAuth: Added instance URL extraction from userinfo endpoint and storage in scope field for proper API routing
  • Infrastructure: Added instanceUrl context param support and arrayBuffer/blob methods to mock responses

All changes maintain backward compatibility in response structure while improving the output schema definitions for better developer experience.

Confidence Score: 5/5

  • This PR is safe to merge with no blocking issues
  • All changes are well-structured bug fixes and improvements to tool output schemas. The flattening of output structures improves type safety and API documentation without breaking existing functionality. API-specific fixes (Pinecone empty response, Typeform 204 handling, Supabase path construction) correctly address real API behaviors. The Salesforce instance URL extraction is a clean enhancement.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/tools/intercom/create_contact.ts Flattened output schema to expose detailed contact properties directly instead of generic object
apps/sim/tools/intercom/search_contacts.ts Flattened outputs and added detailed contact schema with typed pagination structure
apps/sim/tools/pinecone/upsert_text.ts Simplified output to statusText only, removed incorrect upsertedCount (Pinecone returns 201 with empty body)
apps/sim/tools/supabase/storage_upload.ts Split path parameter into fileName (required) and path (optional folder), improved URL construction logic
apps/sim/tools/typeform/update_form.ts Improved response handling for empty/204 responses, simplified output to success message only
apps/sim/blocks/blocks/typeform.ts Enhanced operations field with code editor, AI wand config, and comprehensive JSON Patch documentation
apps/sim/lib/auth/auth.ts Added Salesforce instance URL extraction from userinfo and storage in scope field
apps/sim/tools/index.ts Added instanceUrl to context params and arrayBuffer/blob methods to mock response

Sequence Diagram

sequenceDiagram
    participant User
    participant Block
    participant ToolExecutor
    participant Tool
    participant API
    
    User->>Block: Configure tool parameters
    Block->>ToolExecutor: Execute tool with params
    
    alt OAuth Required (e.g., Intercom, Salesforce)
        ToolExecutor->>ToolExecutor: Get access token from auth
        Note over ToolExecutor: For Salesforce: Extract instanceUrl from scope
        ToolExecutor->>ToolExecutor: Add accessToken/instanceUrl to params
    end
    
    ToolExecutor->>Tool: Call tool.request with params
    Tool->>Tool: Build URL, headers, body
    Tool->>API: HTTP Request (GET/POST/PATCH/DELETE)
    
    alt Success Response
        API-->>Tool: 200/201/204 Response
        Tool->>Tool: transformResponse()
        
        alt Pinecone Upsert
            Note over Tool: Returns 201 with empty body<br/>Return {statusText: "Created"}
        else Typeform Update
            Note over Tool: May return 204 or empty body<br/>Return {message: "success"}
        else Intercom Operations
            Note over Tool: Parse JSON response<br/>Return detailed typed objects
        else Supabase Storage
            Note over Tool: Construct path from fileName + path<br/>Return upload results
        end
        
        Tool-->>ToolExecutor: {success: true, output: {...}}
    else Error Response
        API-->>Tool: 4xx/5xx Response
        Tool->>Tool: handleError()
        Tool-->>ToolExecutor: {success: false, error: "..."}
    end
    
    ToolExecutor-->>Block: Flattened output structure
    Note over Block: outputs config describes<br/>top-level fields in output object
    Block-->>User: Display results with typed fields
Loading

@aadamgough aadamgough merged commit 27ec412 into staging Dec 26, 2025
10 checks passed
@aadamgough aadamgough deleted the fix/tool-ops branch December 26, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants