Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • added clerk tools and block

Type of Change

  • New feature

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 27, 2026

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

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 28, 2026 0:45am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR adds comprehensive Clerk authentication integration to Sim, introducing 11 new tools and a unified block for managing users, organizations, and sessions.

Changes

  • User Management Tools: list_users, get_user, create_user, update_user, delete_user provide full CRUD operations for Clerk users with support for emails, phone numbers, metadata, and external IDs
  • Organization Management Tools: list_organizations, get_organization, create_organization enable organization management with member counts and custom metadata
  • Session Management Tools: list_sessions, get_session, revoke_session allow monitoring and controlling user authentication sessions
  • Block Configuration: Single Clerk block with dropdown operation selector and conditional UI fields for each operation type
  • Type Definitions: Comprehensive TypeScript types covering all Clerk API entities and responses
  • Documentation: MDX documentation with detailed parameter tables for all 11 operations
  • Registry Updates: Tools and blocks properly registered in their respective registries

Architecture

The implementation follows established patterns in the codebase:

  • Uses ToolConfig type with params, request, transformResponse, and outputs structure
  • Properly uses visibility: 'user-only' for the secretKey parameter (not hidden, which is reserved for OAuth tokens)
  • Leverages block-level parameter mapping to provide clean UI abstractions
  • Implements comprehensive error handling with logger integration
  • Transforms snake_case API responses to camelCase for consistency

Issues Found

  • Documentation error: Output field descriptions are duplicated and incorrect in clerk.mdx (line 61 shows "Phone number ID" for user id, lines 72 and 76 have duplicate emailAddress/phoneNumber entries)

Confidence Score: 4/5

  • Safe to merge with one documentation fix needed
  • The implementation is solid with proper error handling, type safety, and follows established patterns. The only issue is a documentation error with duplicate/incorrect field descriptions that should be corrected before merge.
  • Fix documentation in apps/docs/content/docs/en/tools/clerk.mdx before merging

Important Files Changed

Filename Overview
apps/sim/tools/clerk/create_user.ts New tool for creating Clerk users with proper validation and error handling
apps/sim/tools/clerk/list_users.ts New tool for listing users with filtering and pagination
apps/sim/tools/clerk/types.ts Comprehensive TypeScript types for all Clerk API operations
apps/sim/blocks/blocks/clerk.ts Block configuration with comprehensive UI fields for all 11 Clerk operations
apps/docs/content/docs/en/tools/clerk.mdx Documentation with duplicate field descriptions in output tables

Sequence Diagram

sequenceDiagram
    participant User
    participant Sim Workflow
    participant Clerk Block
    participant Tool Registry
    participant Clerk API
    
    User->>Sim Workflow: Configure Clerk Block
    User->>Clerk Block: Select operation (e.g., "List Users")
    User->>Clerk Block: Provide Secret Key
    User->>Clerk Block: Set operation parameters
    
    Sim Workflow->>Clerk Block: Execute block
    Clerk Block->>Clerk Block: Map UI params to tool params
    Clerk Block->>Tool Registry: Request tool (e.g., clerk_list_users)
    Tool Registry-->>Clerk Block: Return tool config
    
    Clerk Block->>Clerk API: HTTP Request with Authorization
    Note over Clerk Block,Clerk API: GET/POST/PATCH/DELETE to<br/>api.clerk.com/v1/*
    
    alt Success
        Clerk API-->>Clerk Block: 200 OK + Response data
        Clerk Block->>Clerk Block: Transform response
        Clerk Block-->>Sim Workflow: Return formatted output
        Sim Workflow-->>User: Display results
    else Error
        Clerk API-->>Clerk Block: 4xx/5xx + Error details
        Clerk Block->>Clerk Block: Log error
        Clerk Block-->>Sim Workflow: Throw error with message
        Sim Workflow-->>User: Show error message
    end
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.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit bca355c into staging Jan 28, 2026
6 of 7 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/tools branch January 28, 2026 00:45
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