Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

@icecrasher321 icecrasher321 commented Jan 18, 2026

Summary

  • transformTable was not parsing agent output to the subblock correctly
  • organized this subblock specific parsing code better

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 Jan 18, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 18, 2026 10:40pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 18, 2026

Greptile Summary

Refactored transformTable to handle multiple input formats (string, plain object, array) from agent outputs. Extracted tag-related utilities and transformTable into dedicated shared modules (shared/tags.ts and shared/table.ts) to improve code organization and break circular dependencies.

Key Changes:

  • Extended transformTable to parse JSON strings and pass through plain objects (in addition to existing TableRow[] support)
  • Moved transformTable from tools/utils.ts and tools/http/utils.ts to tools/shared/table.ts
  • Extracted tag utility functions from tools/params.ts to tools/shared/tags.ts
  • Updated all imports across affected files

Issues Found:

  • Missing test coverage for new string and plain object input handling in transformTable

Confidence Score: 4/5

  • This PR is safe to merge with minor test coverage gaps
  • The refactoring improves code organization by consolidating duplicate code and breaking circular dependencies. The logic changes extend transformTable to handle additional input formats, which aligns with the stated bug fix. However, the PR lacks test coverage for the new functionality (string and plain object inputs), which reduces confidence slightly. The existing array handling is well-tested and unchanged.
  • apps/sim/tools/shared/table.ts requires additional test coverage for the new string and plain object input handling

Important Files Changed

Filename Overview
apps/sim/tools/shared/table.ts New file created to handle table transformations with extended input format support (string, object, array). Missing tests for new string/object input handling.
apps/sim/tools/http/request.ts Updated import to use transformTable from shared/table.ts instead of http/utils.ts.
apps/sim/tools/utils.test.ts Updated import to use transformTable from shared/table.ts instead of utils.ts.

Sequence Diagram

sequenceDiagram
    participant Agent as Agent Output
    participant Tool as HTTP Request Tool
    participant Transform as transformTable()
    participant API as External API

    Agent->>Tool: Provide table data (string/object/array)
    Tool->>Transform: Call transformTable(params.headers)
    
    alt Input is string (JSON)
        Transform->>Transform: JSON.parse(table)
        Transform->>Transform: Recursive call with parsed data
    end
    
    alt Input is array (TableRow[])
        Transform->>Transform: Iterate rows, extract Key/Value from cells
        Transform-->>Tool: Return key-value object
    end
    
    alt Input is plain object
        Transform-->>Tool: Return object as-is
    end
    
    alt Input is null/undefined
        Transform-->>Tool: Return empty object
    end
    
    Tool->>API: Send HTTP request with transformed headers
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@icecrasher321 icecrasher321 merged commit 1dbf92d into staging Jan 18, 2026
10 checks passed
@icecrasher321 icecrasher321 deleted the fix/api-toolinp branch January 18, 2026 22:43
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