Skip to content

feat(agent-toolkit): add use_template and check_template_status tools#367

Open
koch-tom wants to merge 4 commits into
mondaycom:masterfrom
koch-tom:tomko/agentic-use-template
Open

feat(agent-toolkit): add use_template and check_template_status tools#367
koch-tom wants to merge 4 commits into
mondaycom:masterfrom
koch-tom:tomko/agentic-use-template

Conversation

@koch-tom
Copy link
Copy Markdown

Summary

  • Adds use_template tool to apply a monday.com template asynchronously, returning a process_id immediately
  • Adds check_template_status tool to poll the operation status until COMPLETE, returning structured output including board_ids and board_ids_map
  • Adds use_template_status query and supporting types (UseTemplateStatus enum, UseTemplateStatusType) to schema.graphql — depends on the use_template_status query added in Development/dapulse

Key design decisions

  • templateId / destinationWorkspaceId use z.coerce.number().int().positive() so the MCP layer rejects non-numeric input before the tool is called (avoids silent NaN → null API errors)
  • boardKind is optional with no default, letting the API use its server-side default
  • check_template_status returns structured content { status, board_ids, board_ids_map } on COMPLETE so agents can use the source→destination board mapping directly
  • is_complete / is_failed removed from the polling query (redundant with status); board_ids_map is now surfaced in the response
  • Tool description advises polling every 5–10 seconds to avoid rate-limit hammering

Test plan

  • use_template passes numeric IDs directly to the mutation (no parseInt)
  • Schema rejects templateId: 'abc' / '' / 0 via Zod validation
  • boardKind is undefined in variables when omitted
  • check_template_status returns structured { board_ids, board_ids_map } on COMPLETE
  • check_template_status returns explicit "Unexpected status" message for unknown status values
  • All 1000 existing tests pass (npm test)

🤖 Generated with Claude Code

koch-tom and others added 3 commits May 28, 2026 17:20
…with tests

- Implemented CheckTemplateStatusTool to check the status of a use_template operation, including handling various status responses (COMPLETE, FAILED, IN_PROGRESS, PENDING).
- Added UseTemplateTool to apply a template and return a process ID for tracking.
- Created unit tests for both tools to ensure correct functionality and response handling.
- Updated GraphQL queries to support the new tools and added necessary types in the generated schema.
- Revert accidental prettier reformat of changeItemColumnValues query
- Make all check_template_status branches return consistent structured
  content { status, board_ids, board_ids_map, message } so agents never
  need to branch on typeof content
- Fix poll-stop condition: description and return message now explicitly
  say to stop on FAILED (not just COMPLETE), preventing infinite polling
  on failed jobs
- Add ~5 min give-up hint to description and return message
- Fix "in_progress" → "in progress" in status message
- Add PENDING test case and undefined process_id test case

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
templateId: z.coerce.number().int().positive().describe('The template ID to apply.'),
destinationWorkspaceId: z.coerce.number().int().positive().optional().describe('Target workspace ID.'),
destinationName: z.string().optional().describe('Name for the created instance or folder.'),
boardKind: z
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what is this? if user installs workspace template what does it mean?

…on_status

Aligns with the rename on the dapulse side (DaPulse/dapulse#110411).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants