Skip to content

feat(tools): added clerk tools and block - #3032

Merged
waleedlatif1 merged 3 commits into
stagingfrom
feat/tools
Jan 28, 2026
Merged

feat(tools): added clerk tools and block#3032
waleedlatif1 merged 3 commits into
stagingfrom
feat/tools

Conversation

@waleedlatif1

Copy link
Copy Markdown
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

vercelBot commented Jan 27, 2026

Copy link
Copy Markdown

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

ProjectDeploymentReviewUpdated (UTC)
docsReadyReadyPreview, CommentJan 28, 2026 0:45am

Request Review

@greptile-apps

Copy link
Copy Markdown
Contributor

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

FilenameOverview
apps/sim/tools/clerk/create_user.tsNew tool for creating Clerk users with proper validation and error handling
apps/sim/tools/clerk/list_users.tsNew tool for listing users with filtering and pagination
apps/sim/tools/clerk/types.tsComprehensive TypeScript types for all Clerk API operations
apps/sim/blocks/blocks/clerk.tsBlock configuration with comprehensive UI fields for all 11 Clerk operations
apps/docs/content/docs/en/tools/clerk.mdxDocumentation 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

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

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

Comment threadapps/docs/content/docs/en/tools/clerk.mdx Outdated

@cursorcursorBot left a comment

Copy link
Copy Markdown

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.

Comment threadapps/sim/tools/clerk/types.ts
@waleedlatif1
waleedlatif1 merged commit bca355c into stagingJan 28, 2026
6 of 7 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/tools branch January 28, 2026 00:45
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
* feat(tools): added clerk tools and block
* updated docs gen script
* use clerk api types
Sign up for freeto 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.

1 participant

@waleedlatif1