Skip to content

feat(confluence): add all missing Confluence tools#3355

Closed
waleedlatif1 wants to merge 16 commits intomainfrom
waleedlatif1/confluence-all-tools
Closed

feat(confluence): add all missing Confluence tools#3355
waleedlatif1 wants to merge 16 commits intomainfrom
waleedlatif1/confluence-all-tools

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add 14 new Confluence tools: Get User, List/Get/Update Tasks, Update/Delete Blog Post, Create/Update/Delete Space, Get Page Descendants, List Space Permissions, List/Create/Delete Space Properties
  • Add 9 missing OAuth scopes to auth.ts provider config
  • Fix body-format=storage missing on page and blogpost update GET-before-PUT (prevents content erasure)
  • Fix list_tasks pagination dropping assignedTo/status filters
  • Fix spaceId incorrectly required for create_space
  • Fix space update failing when only providing description (name is required by API)
  • Use validatePathSegment with custom pattern for Atlassian account IDs

Type of Change

  • New feature
  • 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)

waleedlatif1 and others added 16 commits February 26, 2026 14:02
…scendants, permissions, and properties

Add 16 new Confluence operations: list/get/update tasks, update/delete blog posts,
create/update/delete spaces, get page descendants, list space permissions,
list/create/delete space properties. Includes API routes, tool definitions,
block config wiring, OAuth scopes, and generated docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The OAuth authorization flow uses scopes from auth.ts, not oauth.ts.
The 9 new scopes were only added to oauth.ts and the block config but
not to the actual provider config in auth.ts, causing re-auth to still
return tokens without the new scopes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove apostrophe from description that caused MDX generation to
truncate at the escape character.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move get_user from GET to POST to avoid exposing access token in URL
- Add 400 validation for missing params in space-properties create/delete
- Add null check for blog post version before update to prevent TypeError

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add type and depth fields to page descendants (from Confluence API)
- Add body field (storage format) to task list/get/update responses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
validateAlphanumericId rejects valid Atlassian account IDs that contain
colons (e.g. 557058:6b9c9931-4693-49c1-8b3a-931f1af98134). Use
validatePathSegment with a custom pattern allowing colons instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Return 400 when neither name nor description is provided for space
update, instead of sending an empty body to the Confluence API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…list_tasks pagination

- Remove create_space from spaceId condition array since creating a space
  doesn't require a space ID input
- Remove list_tasks from generic supportsCursor array so it uses its
  dedicated handler that correctly passes assignedTo and status filters
  during pagination

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without this param, the Confluence v2 API does not return body content,
causing the fallback to erase existing content when only updating the title.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Same bug class as the blogpost fix — without this param, the Confluence
v2 API does not return body content, causing the fallback to erase page
content when only updating the title.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Confluence v2 PUT /spaces/{id} endpoint requires the name field.
When the user only provides a description update, fetch the current
space first to preserve the existing name.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 26, 2026

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

Project Deployment Actions Updated (UTC)
docs Building Building Preview, Comment Feb 26, 2026 10:02pm

Request Review

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 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

],
value: () => 'complete',
condition: { field: 'operation', value: 'update_task' },
},
Copy link

Choose a reason for hiding this comment

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

List tasks status filter missing in block UI

Medium Severity

The list_tasks operation supports filtering by status (complete/incomplete) in the API, and the PR fixed pagination to preserve this filter, but the block UI only shows the "Assigned To" filter for list_tasks. The taskStatus field is shown only for update_task, so users cannot filter tasks by status when listing from the block.

Fix in Cursor Fix in Web

'list_space_permissions',
'list_space_properties',
'create_space_property',
'delete_space_property',
Copy link

Choose a reason for hiding this comment

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

List tasks pageId and spaceId filters missing in block UI

Low Severity

The list_tasks operation supports optional pageId and spaceId filters in the API, but the block UI does not expose them. The spaceId field condition omits list_tasks, and the manualPageId field uses not: true with list_tasks in its exclusion list, so both inputs are hidden when listing tasks. Users cannot filter tasks by page or space from the block.

Fix in Cursor Fix in Web

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

This PR significantly expands Confluence integration by adding 14 new tools and fixing several critical bugs that could cause data loss.

New Tools Added:

  • User operations: Get User
  • Task operations: List Tasks, Get Task, Update Task
  • Blog post operations: Update Blog Post, Delete Blog Post
  • Space operations: Create Space, Update Space, Delete Space
  • Space property operations: List/Create/Delete Space Properties
  • Space permissions: List Space Permissions
  • Page operations: Get Page Descendants

Critical Bug Fixes:

  • Fixed page and blog post updates missing body-format=storage parameter on GET-before-PUT requests, which prevented content erasure when updating without providing new content
  • Fixed list_tasks pagination dropping assignedTo and status filters when using cursor pagination
  • Fixed create_space incorrectly requiring spaceId parameter
  • Fixed update_space failing when only description provided (API requires name, now fetches current name automatically)

OAuth & Configuration:

  • Added 9 new OAuth scopes to both auth.ts and oauth.ts for extended functionality
  • Updated OAuth modal with user-friendly descriptions for new scopes
  • All new tools properly registered in tool registry and block configurations

Implementation Quality:

  • All endpoints follow established patterns with proper input validation using validateAlphanumericId and validateJiraCloudId
  • User endpoint uses validatePathSegment with custom pattern for Atlassian account IDs (format: 557058:6b9c9931-...)
  • Comprehensive error handling and logging throughout
  • Proper authentication checks via checkSessionOrInternalAuth

Confidence Score: 4/5

  • Safe to merge with minor concerns about PR scope
  • High-quality implementation that follows established patterns with critical bug fixes. Score reflects large PR size (3874 lines) making comprehensive review challenging, and includes one unrelated feature (workflow audit logging). All new tools properly validated, OAuth scopes consistently added, and bug fixes address real data integrity issues.
  • No files require special attention - all implementations follow consistent patterns with proper validation

Important Files Changed

Filename Overview
apps/sim/lib/auth/auth.ts Added 9 new OAuth scopes for extended Confluence functionality (tasks, blog posts, spaces, space properties, permissions, and user profiles)
apps/sim/lib/oauth/oauth.ts Added matching OAuth scopes to provider config, ensuring consistency with auth.ts
apps/sim/app/api/tools/confluence/page/route.ts Fixed critical bug: added body-format=storage to GET request before PUT to prevent content erasure during page updates
apps/sim/app/api/tools/confluence/blogposts/route.ts Fixed critical bug: added body-format=storage to GET request before PUT, plus implemented complete blogpost CRUD operations (create, read, update, delete)
apps/sim/app/api/tools/confluence/tasks/route.ts Fixed pagination bug: query filters (assignedTo, status) are now correctly preserved when using cursor pagination. Implements list, get, and update operations for Confluence inline tasks
apps/sim/app/api/tools/confluence/space/route.ts Fixed bug: space update now fetches current name when only description is provided (name is required by API). Implements complete space CRUD operations
apps/sim/app/api/tools/confluence/user/route.ts New endpoint for fetching Confluence user profiles. Uses validatePathSegment with custom pattern for Atlassian account IDs (format: 557058:6b9c9931-4693-49c1-8b3a-931f1af98134)
apps/sim/tools/confluence/index.ts Added exports for 14 new Confluence tools organized by category (user, blog posts, spaces, space properties, space permissions, tasks, page descendants)
apps/sim/tools/registry.ts Registered all 14 new Confluence tools in the global tool registry
apps/sim/blocks/blocks/confluence.ts Updated Confluence block definitions to include all new operations with proper OAuth scopes and conditional field visibility

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Start[User Selects Confluence Tool] --> OAuth{OAuth Required?}
    OAuth -->|Yes| CheckScopes[Check OAuth Scopes]
    CheckScopes --> AuthConfig[auth.ts & oauth.ts<br/>Define Required Scopes]
    AuthConfig --> Modal[OAuth Modal Shows<br/>Scope Descriptions]
    Modal --> Authorized[User Authorizes]
    
    OAuth -->|Cached Token| ToolDef[Tool Definition]
    Authorized --> ToolDef
    
    ToolDef --> Registry[tools/registry.ts<br/>Tool Registry Lookup]
    Registry --> BlockConfig[blocks/confluence.ts<br/>Block Configuration]
    BlockConfig --> APIRoute[API Route Handler<br/>app/api/tools/confluence/]
    
    APIRoute --> Validate[Input Validation<br/>validateAlphanumericId<br/>validateJiraCloudId<br/>validatePathSegment]
    Validate --> Auth[Auth Check<br/>checkSessionOrInternalAuth]
    Auth --> CloudID{CloudId<br/>Provided?}
    CloudID -->|No| FetchCloud[Fetch from Domain]
    CloudID -->|Yes| CallAPI
    FetchCloud --> CallAPI[Call Confluence API]
    
    CallAPI --> NewTools[14 New Tools:<br/>Tasks, Blog Posts, Spaces,<br/>Space Properties, Permissions,<br/>Page Descendants, User]
    CallAPI --> BugFixes[Bug Fixes:<br/>body-format=storage<br/>pagination filters<br/>space name requirement]
    
    NewTools --> Response[Transform Response]
    BugFixes --> Response
    Response --> Output[Return to User]
Loading

Last reviewed commit: 8b2a917

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.

33 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 deleted the waleedlatif1/confluence-all-tools branch February 26, 2026 23:05
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.

1 participant