Skip to content

Fix create_list_from_template URL path#5

Open
Esteban-Rod wants to merge 2 commits into
nsxdavid:mainfrom
Esteban-Rod:fix/create-list-from-template-url
Open

Fix create_list_from_template URL path#5
Esteban-Rod wants to merge 2 commits into
nsxdavid:mainfrom
Esteban-Rod:fix/create-list-from-template-url

Conversation

@Esteban-Rod

@Esteban-Rod Esteban-Rod commented Apr 29, 2026

Copy link
Copy Markdown

Summary

Fixes #4.

createListFromTemplateInFolder and createListFromTemplateInSpace were calling /folder/{id}/list/template/{templateId} and /space/{id}/list/template/{templateId}, both of which return HTTP 404. The ClickUp REST API expects /list_template/{templateId} (one segment, with an underscore) per the official createListFromTemplate and createListFromTemplateInSpace endpoints.

Verification

Built locally and ran the server in stdio mode against a real workspace. After the fix, create_list_from_template_in_folder returns the created list (200 OK), with the template's statuses, custom fields, milestones and sub-tasks intact. Before the fix it returned 404 deterministically.

Test plan

  • Built (npm run build) without errors
  • Manual stdio invocation against a real workspace returns a created list
  • Created list has the template's custom statuses, custom fields and milestones
  • Reviewer to confirm in their own workspace

Summary by CodeRabbit

  • Bug Fixes
    • Fixed HTTP 404 when creating lists from templates in folders and spaces.
    • After creating a list from a template, the client now attempts to refresh the newly created list so returned details are more complete; if the refresh fails, the original creation response is preserved.
    • Updated changelog to record the fix.

The two methods `createListFromTemplateInFolder` and
`createListFromTemplateInSpace` in `src/clickup-client/lists.ts` were
calling `/folder/{id}/list/template/{templateId}` and
`/space/{id}/list/template/{templateId}`, which return HTTP 404.

The ClickUp REST API actually expects `/list_template/{templateId}`
(underscore) per the official endpoints:
- https://developer.clickup.com/reference/createlistfromtemplate
- https://developer.clickup.com/reference/createlistfromtemplateinspace

Replacing `list/template` with `list_template` makes the two MCP tools
work as documented. Verified locally against a real workspace by
building and invoking the server in stdio mode — the list is now
created with the template's statuses, custom fields, milestones and
sub-tasks intact.
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dbf58233-00be-4226-acb1-3c105431f9bf

📥 Commits

Reviewing files that changed from the base of the PR and between c522117 and 9db3cec.

📒 Files selected for processing (1)
  • src/clickup-client/lists.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/clickup-client/lists.ts

📝 Walkthrough

Walkthrough

Updates the ClickUp list-template creation methods: fixes endpoint paths from /list/template/{templateId} to /list_template/{templateId} and changes post-create control flow to conditionally refetch the created list by id (returns refetched getList result when available); JSDoc and CHANGELOG updated.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added Unreleased → Fixed entry documenting corrected ClickUp API URL path and behavior changes.
API client: list template creation
src/clickup-client/lists.ts
Replaced /list/template/{templateId} with /list_template/{templateId} for folder- and space-scoped POSTs; added post-POST refetch: if POST returns an id, call getList(id) and return its result, otherwise return original POST response; updated JSDoc to describe refetch and return semantics.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant ListsClient as "lists.ts"
  participant ClickUpAPI as "ClickUp API"
  participant GetList as "getList()"

  Caller->>ListsClient: create_list_from_template_in_folder/space(params)
  ListsClient->>ClickUpAPI: POST /{folder|space}/list_template/{templateId} (params)
  ClickUpAPI-->>ListsClient: 200 OK { id: createdListId, ... }
  alt createdListId present
    ListsClient->>GetList: getList(createdListId)
    GetList->>ClickUpAPI: GET /list/{createdListId}
    ClickUpAPI-->>GetList: 200 OK { full list object }
    GetList-->>ListsClient: full list object
    ListsClient-->>Caller: full list object
  else no id or refetch fails
    ListsClient-->>Caller: original POST response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

"I'm a rabbit who hops through code and logs,
Fixed an underscore, escaped the 404 bogs.
After creating a list I peek once more,
Fetching the real thing from ClickUp's store.
Hop! Templates work — time for carrot and clogs!" 🥕🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: fixing the URL path for create_list_from_template methods from list/template to list_template.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #4: corrects the URL path from list/template to list_template in both methods, includes proper JSDoc updates, and implements post-creation refetch to handle transient deleted:true values.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the URL path issue in lists.ts and documenting it in CHANGELOG.md; the refetch logic addition is a justified improvement to handle ClickUp API quirks rather than scope creep.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

ClickUp's POST /folder/{id}/list_template/{tid} (and the space variant)
returns the freshly created list with deleted:true — an artefact of how
the API serializes the just-spawned record. A refetch via getList shows
deleted:false. Rather than expose this footgun to callers, the client
now refetches the list immediately after creation and falls back to the
raw response only if the refetch fails.
@Esteban-Rod

Copy link
Copy Markdown
Author

Adding a small follow-up commit (9db3cec) to this PR: after the URL path fix lands, the API still returns deleted: true on the freshly created list (a quirk where the response object reflects template-source state). The commit refetches the list via getList immediately after creation so callers see deleted: false + the actual statuses; falls back to the raw response if the refetch fails for any reason. Both *_in_folder and *_in_space are covered. Happy to split this into a separate PR if you'd prefer.

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.

create_list_from_template_in_folder/space returns HTTP 404 (wrong URL path)

1 participant