Skip to content

feat(jsm): add ProForma/JSM Forms discovery tools#4078

Merged
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/san-juan-v1
Apr 9, 2026
Merged

feat(jsm): add ProForma/JSM Forms discovery tools#4078
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/san-juan-v1

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Apr 9, 2026

Summary

  • Add three new JSM Forms tools: jsm_get_form_templates, jsm_get_form_structure, jsm_get_issue_forms
  • All endpoints validated against the official Atlassian Forms REST API OpenAPI spec
  • Enables dynamic form-based workflows: discover forms → extract schema → build dynamic UIs → submit via create_request with formAnswers

New Tools

Tool API Endpoint Purpose
jsm_get_form_templates GET /project/{projectIdOrKey}/form List form templates in a project with request type bindings
jsm_get_form_structure GET /project/{projectIdOrKey}/form/{formId} Get full form design (questions, layout, conditions, sections, settings)
jsm_get_issue_forms GET /issue/{issueIdOrKey}/form List forms attached to an issue with submission/lock status

Files Changed

  • 3 new API routes: apps/sim/app/api/tools/jsm/forms/{templates,structure,issue}/route.ts
  • 3 new tool configs: apps/sim/tools/jsm/get_form_{templates,structure}.ts, get_issue_forms.ts
  • Updated: types, index barrel, registry, block config (3 new operations + subBlocks), docs

Test plan

  • Verify jsm_get_form_templates returns form template index entries for a project
  • Verify jsm_get_form_structure returns full FormDesign with questions, layout, conditions
  • Verify jsm_get_issue_forms returns form index entries for an issue
  • Verify block dropdown shows all three new operations
  • Verify projectIdOrKey and formId inputs appear/hide correctly based on operation
  • Verify existing JSM operations are unaffected (backward compatibility)

Add three new tools for discovering and inspecting JSM Forms (ProForma) templates
and their structure, enabling dynamic form-based workflows:

- jsm_get_form_templates: List form templates in a project with request type bindings
- jsm_get_form_structure: Get full form design (questions, layout, conditions, sections)
- jsm_get_issue_forms: List forms attached to an issue with submission status

All endpoints validated against the official Atlassian Forms REST API OpenAPI spec.
Uses the Forms Cloud API base URL (jira/forms/cloud/{cloudId}) with X-ExperimentalApi header.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 9, 2026 8:51pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

PR Summary

Medium Risk
Adds new authenticated server routes and tool definitions that call Atlassian’s JSM Forms API; risk is mainly in request validation/URL construction and potential API/shape mismatches, but changes are additive to existing JSM functionality.

Overview
Adds three new JSM Forms (ProForma) discovery tools: jsm_get_form_templates, jsm_get_form_structure, and jsm_get_issue_forms, each backed by a new authenticated Next.js API route that calls Atlassian’s Forms REST endpoints and normalizes results.

Updates the JSM integration surface area by wiring these operations into the block UI/params mapping, tool registry/index, and shared jsm types (new params/response interfaces + output property schemas), and documents the new tools in jira_service_management.mdx while bumping the integration operation count in integrations.json.

Reviewed by Cursor Bugbot for commit 39b276b. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR adds three new JSM Forms (ProForma) discovery tools — jsm_get_form_templates, jsm_get_form_structure, and jsm_get_issue_forms — along with their corresponding API routes, types, and block config entries. The previously flagged security issues (path-traversal validation on projectIdOrKey and formId) and the parseJsmErrorMessage duplication have all been resolved in follow-up commits.

Confidence Score: 5/5

This PR is safe to merge — all previously flagged security and duplication issues have been resolved in follow-up commits.

All three new tools follow established JSM patterns consistently. Input validation is applied before URL construction in every route. The shared parseJsmErrorMessage utility eliminates the copy-paste concern. Block config changes (subBlocks, conditions, params switch cases) are complete and correct. No new P0 or P1 findings remain.

No files require special attention.

Vulnerabilities

No security concerns identified. Input validation (validateJiraIssueKey for projectIdOrKey, validateJiraCloudId for formId and cloudId) is applied before URL construction in all three routes, mitigating path-traversal risks.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/jsm/forms/templates/route.ts New API route for listing form templates; input validation and shared error parser are properly applied.
apps/sim/app/api/tools/jsm/forms/structure/route.ts New API route for fetching form structure; both projectIdOrKey and formId are validated before use.
apps/sim/app/api/tools/jsm/forms/issue/route.ts New API route for listing issue forms; follows same validation pattern as existing JSM routes.
apps/sim/tools/jsm/utils.ts Added getJsmFormsApiBaseUrl, getJsmHeaders, and parseJsmErrorMessage as shared utilities; proper extraction from the three route files.
apps/sim/tools/jsm/types.ts Added FORM_TEMPLATE_PROPERTIES, ISSUE_FORM_PROPERTIES, interfaces and response types for the three new tools; new union members added to JsmResponse.
apps/sim/blocks/blocks/jira_service_management.ts Three new dropdown options added; projectIdOrKey and formId subBlocks properly conditioned; new params cases in tools.config are complete and consistent.
apps/sim/tools/jsm/index.ts Barrel export updated with three new tool exports.
apps/sim/tools/registry.ts Three new tool entries registered correctly.

Sequence Diagram

sequenceDiagram
    participant UI as Block UI
    participant Exec as Executor
    participant Route as API Route
    participant Val as Input Validation
    participant Atlassian as Atlassian Forms API

    UI->>Exec: operation = get_form_templates / get_form_structure / get_issue_forms
    Exec->>Route: POST /api/tools/jsm/forms/{templates|structure|issue}
    Route->>Val: validateJiraCloudId(cloudId)
    Route->>Val: validateJiraIssueKey(projectIdOrKey) or validateJiraIssueKey(issueIdOrKey)
    Route->>Val: validateJiraCloudId(formId) [structure only]
    Val-->>Route: validation result
    Route->>Atlassian: GET /project/{key}/form [templates]
    Route->>Atlassian: GET /project/{key}/form/{id} [structure]
    Route->>Atlassian: GET /issue/{key}/form [issue forms]
    Atlassian-->>Route: FormTemplateIndexEntry[] / FormDesign / FormIndexEntry[]
    Route-->>Exec: { success, output: { templates|design|forms, total } }
    Exec-->>UI: rendered output
Loading

Reviews (3): Last reviewed commit: "chore(jsm): remove unused FORM_QUESTION_..." | Re-trigger Greptile

- Add validateJiraIssueKey for projectIdOrKey in templates and structure routes
- Add validateJiraCloudId for formId (UUID) in structure route
- Extract parseJsmErrorMessage to shared utils.ts (was duplicated across 3 routes)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@waleedlatif1 waleedlatif1 reopened this Apr 9, 2026
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Dead code — the get_form_structure tool passes the raw design object
through as JSON, so this output constant had no consumers.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@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.

Fix All in Cursor

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

Reviewed by Cursor Bugbot for commit 39b276b. Configure here.

@waleedlatif1 waleedlatif1 merged commit 70f04c0 into staging Apr 9, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/san-juan-v1 branch April 9, 2026 20:58
waleedlatif1 added a commit that referenced this pull request Apr 10, 2026
* feat(jsm): add ProForma/JSM Forms discovery tools

Add three new tools for discovering and inspecting JSM Forms (ProForma) templates
and their structure, enabling dynamic form-based workflows:

- jsm_get_form_templates: List form templates in a project with request type bindings
- jsm_get_form_structure: Get full form design (questions, layout, conditions, sections)
- jsm_get_issue_forms: List forms attached to an issue with submission status

All endpoints validated against the official Atlassian Forms REST API OpenAPI spec.
Uses the Forms Cloud API base URL (jira/forms/cloud/{cloudId}) with X-ExperimentalApi header.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* fix(jsm): add input validation and extract shared error parser

- Add validateJiraIssueKey for projectIdOrKey in templates and structure routes
- Add validateJiraCloudId for formId (UUID) in structure route
- Extract parseJsmErrorMessage to shared utils.ts (was duplicated across 3 routes)

Co-Authored-By: Claude Opus 4.6 <[email protected]>

* chore(jsm): remove unused FORM_QUESTION_PROPERTIES constant

Dead code — the get_form_structure tool passes the raw design object
through as JSON, so this output constant had no consumers.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
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