feat(agent-toolkit): add image from file upload to update_doc tool#262
Closed
RoniLandau wants to merge 3 commits intomasterfrom
Closed
feat(agent-toolkit): add image from file upload to update_doc tool#262RoniLandau wants to merge 3 commits intomasterfrom
RoniLandau wants to merge 3 commits intomasterfrom
Conversation
Add `add_image_from_file` operation to the update_doc tool, enabling image insertion from base64 file data instead of requiring a public URL. The operation works in two steps: 1. Upload the file via `add_file_to_column` to create a monday.com asset 2. Create an image block in the doc using the returned asset ID Also bumps `@mondaydotcomorg/api` from ^13 to ^14 which adds the file upload middleware (auto-detects File/Blob in variables and converts to multipart/form-data). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove item_id/column_id from add_image_from_file input — the tool now auto-resolves them by querying the board (from object_id) for a file column and an item - Add getBoardDataForAsset and getDocById GraphQL queries - Fix File creation: use File with MIME type on Node 20+, Blob fallback with name+type on Node 18 - Add tests for board context resolution, missing file column, missing items Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Accept a local file path instead of base64-encoded data. The tool reads the file from disk directly, avoiding the need to pass large base64 strings (~50KB+ for small images) through MCP tool call JSON parameters which caused agents to choke. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
add_image_from_fileoperation to theupdate_doctool that allows inserting images into monday.com documents from file data (base64-encoded) instead of requiring a public URL@mondaydotcomorg/apifrom^13.0.0to^14.0.0to get the new file upload middleware from monday-graphql-api#8716.20.0to18.0.0(required by SDK v14)How it works
The
add_image_from_fileoperation handles everything automatically — the caller only providesfile_base64andfile_name:Step 0 — Resolve board context
The tool uses the document's
object_id(board ID) to find a file column and an item on the board viagetBoardDataForAssetquery. If onlydoc_idis provided, the tool first resolves it toobject_idviagetDocById.Step 1 — Upload file
Decodes the base64 input and creates a
Fileobject (with proper MIME type derived from extension), then uploads viaadd_file_to_column. The SDK v14 middleware auto-detects theFile/Blobin variables and converts the request tomultipart/form-data.Step 2 — Insert image block
Uses the returned asset ID to create an image block in the document via
create_doc_blockswith theasset_idfield onImageBlockInput.Schema changes
ImageBlockInput(GraphQL + generated types): Addedasset_id: IDfield, madepublic_urloptional. Image blocks can now be created from either a public URL or an asset ID.CreateBlockImageSchema(Zod): Bothpublic_urlandasset_idare optional; runtime validation in the helper ensures at least one is provided.AddImageFromFileOperation: Only requiresfile_base64andfile_name. Optional:after_block_id,parent_block_id,width. Board context (item_id,column_id) is auto-resolved from the document'sobject_id.getDocById(doc_id → object_id),getBoardDataForAsset(board → file column + item)SDK v14 migration
timeout→timeoutMsinget-board-items-page-tool(breaking change in SDK v14)Test plan
asset_idobject_idfromdoc_idwhen onlydoc_idis providedcreate_blockwithpublic_urlstill works🤖 Generated with Claude Code