feat: add add-space-from-template tool#449
Open
Tom8810 wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The kintone MCP had no way to create a new space from an existing space template. Creating spaces typically requires a kintone System Administrator (or a user explicitly granted space-creation rights) and goes through the Templates REST API (
POST /k/v1/template/space.json), so it is a privileged, write operation that should be exposed deliberately rather than as a general user action.To keep the operation safe by default, this tool is disabled when using API token authentication (consistent with
kintone-get-appsandkintone-add-app), since the Templates Space API does not work with API tokens.What
kintone-add-space-from-template: takes a templateid, the new spacename, amembersarray (USER / GROUP / ORGANIZATION entities withisAdminandincludeSubs), and optionalisPrivate,isGuest,fixedMemberflags. CallsKintoneRestAPIClient.space.addSpaceFromTemplateand returns the newly created spaceidas both structured content and pretty-printed JSON text.membersmust contain at least one entry, and at least one of them is expected to haveisAdmin: true(matches the API requirement; otherwise the API rejects the request).isGuest: trueis only valid when the supplied template is a guest space template.false(isPrivate,isGuest,fixedMember,isAdmin,includeSubs).manifest.json,README.md, andREADME_en.mdto list the new tool.tool-filterssokintone-add-space-from-templateis excluded under API token authentication.createMockClientwith aspace.addSpaceFromTemplatemock hook.How to test
KINTONE_BASE_URLand credentials that the Templates Space API accepts (e.g., a kintone System Administrator using username/password; not API-token-only).kintone-add-space-from-templateis not enabled (excluded bytool-filters).kintone-add-space-from-templatewith:id,name,membersarray containing at least one member withisAdmin: true,isPrivate,isGuest,fixedMember.idand that the space is visible in kintone (created immediately on the production environment; no deploy step).membersarray → request is rejected before calling the API,isAdmin: true→ API rejects the request,isGuest: trueagainst a non-guest template → API rejects the request.Checklist
pnpm lintandpnpm teston the root directory.