Skip to content

feat(agent-toolkit): support docOwnerIds in create_doc tool#338

Merged
Noa-Reuven merged 14 commits into
masterfrom
noa/feat/create-doc-owner-ids
May 24, 2026
Merged

feat(agent-toolkit): support docOwnerIds in create_doc tool#338
Noa-Reuven merged 14 commits into
masterfrom
noa/feat/create-doc-owner-ids

Conversation

@Noa-Reuven
Copy link
Copy Markdown
Collaborator

@Noa-Reuven Noa-Reuven commented May 7, 2026

https://monday.monday.com/boards/3713040192/pulses/11854345358

Summary

Add optional docOwnerIds input to the create_doc tool schema — same pattern as PR #335 did for create_board.

Problem

When a personal agent creates a doc, it becomes the doc owner — but it cannot subsequently add the agent owner as a subscriber/member. The reason: the platform performs a dual permission check (agent_permission ∩ agent_owner_permission). Since the agent owner has no access to the newly created doc, this intersection is empty and the invite is blocked.

Fix

The create_doc (board) creation mutation supports passing board_owner_ids as input. Ownership subscription happens inside the mutation itself, bypassing the permission checks that would block a subsequent call. By exposing this parameter in the MCP tool, agents can add the agent owner as a co-owner at creation time.

Changes

  • create-doc-tool.ts — add optional docOwnerIds: string[] field to the tool schema
  • create-doc-tool.graphql.ts — pass $docOwnerIdsboard_owner_ids in the createDoc mutation
  • graphql.ts — add docOwnerIds to CreateDocMutationVariables type (mirrors how PR feat(agent-toolkit): support owners in create_board tool #335 updated CreateBoardMutationVariables)
  • create-doc-tool.test.ts — tests for with/without docOwnerIds

Usage

{
  "location": "workspace",
  "workspace_id": 123,
  "doc_name": "My Doc",
  "markdown": "# Hello",
  "docOwnerIds": ["<agent_owner_user_id>"]
}

Note

npm run codegen should be run to regenerate types from the live schema and verify that board_owner_ids is accepted by the create_doc mutation. The graphql.ts change was made manually following the same pattern as PR #335.

References


🤖 Generated with Claude Code

@Noa-Reuven Noa-Reuven force-pushed the noa/feat/create-doc-owner-ids branch 2 times, most recently from 5f0b819 to a0b5d9c Compare May 11, 2026 09:34
@SergeyRoyt
Copy link
Copy Markdown

Several of the changed files (graphql.ts, gql.ts, schema.graphql, schema.dev.graphql) are codegen-generated. The PR notes the edits were made manually — the generated AST blob in graphql.ts is especially fragile to maintain by hand. Should run npm run codegen before merging to verify the schema accepts doc_owner_ids and replace the manual edits with the real generated output.

@Noa-Reuven Noa-Reuven force-pushed the noa/feat/create-doc-owner-ids branch from a5209fc to 11762aa Compare May 18, 2026 06:06
Copy link
Copy Markdown
Collaborator

@RomKadria RomKadria left a comment

Choose a reason for hiding this comment

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

Update version

@Noa-Reuven Noa-Reuven force-pushed the noa/feat/create-doc-owner-ids branch from 6b48aef to 559b9c0 Compare May 18, 2026 06:24
Noa-Reuven and others added 12 commits May 24, 2026 16:04
Same fix as create_board (PR #335): when an agent creates a doc, the agent
owner has no access due to permission constraints (agent permissions always
intersect with owner permissions). Exposing board_owner_ids at creation time
bypasses these checks, allowing the agent owner to be added as a co-owner.

Changes:
- create-doc-tool.ts: add optional docOwnerIds field to schema
- create-doc-tool.graphql.ts: pass $docOwnerIds → board_owner_ids in mutation
- graphql.ts: add docOwnerIds to CreateDocMutationVariables type
- create-doc-tool.test.ts: add tests for with/without docOwnerIds
…chema

board_owner_ids is not exposed on create_doc in the monday.com GraphQL API
(confirmed via codegen validation against live schema). Removing docOwnerIds
from the tool and mutation until the platform team adds the field to the schema.
The create_board pattern (PR #335) works because board_owner_ids IS on create_board.
Next step: coordinate with docs/platform team to add board_owner_ids to create_doc.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Exposes board_owner_ids on create_doc mutation following the same pattern
as create_board (PR #335). Agents can now pass docOwnerIds to add the agent
owner as co-owner at creation time, bypassing the permission intersection
constraint that blocks subsequent add_users_to_board calls.

- Add board_owner_ids to create_doc in both default and dev schemas
- Update createDoc mutation to include $docOwnerIds variable
- Regenerate types (CreateDocMutationVariables now has docOwnerIds)
- Add docOwnerIds to createDocToolSchema with description
- Spread docOwnerIds into workspace doc creation variables

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ncy with create_board

Matches the naming pattern from PR #335 (create_board): the GraphQL variable
and TypeScript parameter both use boardOwnerIds, which maps to board_owner_ids
on the platform API. Docs are boards internally — naming it boardOwnerIds makes
the connection explicit and consistent.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
More semantic for a doc creation tool — the user is creating a doc,
not a board. board_owner_ids at the GraphQL API level stays unchanged
(docs are boards internally — that's not something we can rename).

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…x stale test references

- Item-attached doc path now forwards boardOwnerIds to board_owner_ids, matching
  the workspace path. Without this, agents creating item docs still hit the
  permission intersection bug (owner has no access → agent can't operate on it).
- Fix stale docOwnerIds → boardOwnerIds in tests
- Add test covering boardOwnerIds forwarding for item location

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Noa-Reuven Noa-Reuven force-pushed the noa/feat/create-doc-owner-ids branch from 0213c76 to 02ac7dc Compare May 24, 2026 13:05
Noa-Reuven and others added 2 commits May 24, 2026 16:06
- Fix describe() referencing add_users_to_board → add_subscribers_to_object
- Add doc_name to all getDescription() usage examples
- Document docOwnerIds as optional in LOCATION TYPES for both workspace and item
- Fix workspace docOwnerIds tests to use jest.spyOn pattern
- Add validation test for empty docOwnerIds array (min 1)
- Update assertions to toEqual(expect.objectContaining(...))

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@Noa-Reuven Noa-Reuven merged commit 3f90c31 into master May 24, 2026
2 checks passed
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.

3 participants