Merged
Conversation
This commit adds comprehensive image insertion capabilities with two new tools: 1. insertImageFromUrl: Inserts images from publicly accessible URLs - Supports custom width/height in points - Uses Google Docs API insertInlineImage request - Validates URL format before insertion 2. insertLocalImage: Uploads local images and inserts them - Uploads image to Google Drive (same folder as document by default) - Makes image publicly readable for document display - Supports .jpg, .jpeg, .png, .gif, .bmp, .webp, .svg formats - Automatically determines MIME type from file extension - Returns Drive URL for uploaded image Helper functions added to googleDocsApiHelpers.ts: - insertInlineImage(): Core image insertion logic - uploadImageToDrive(): Handles local file upload and permissions Documentation: - Updated README.md with detailed usage examples - Added Image Insertion section with both tool descriptions - Updated feature list and advanced usage examples The implementation follows the existing codebase patterns and uses the established error handling mechanisms (UserError for client issues). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
|
Awesome, thank you! |
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.
Add Image Insertion Functionality
This PR adds comprehensive image insertion capabilities to the Google Docs MCP server, enabling users to insert images into documents either from public URLs or by uploading local files.
🎯 Features Added
Two New MCP Tools
insertImageFromUrl- Insert images from publicly accessible URLsinsertLocalImage- Upload local images and insert them🛠️ Implementation Details
Helper Functions (src/googleDocsApiHelpers.ts)
insertInlineImage(): Core image insertion logicinsertInlineImagerequestuploadImageToDrive(): Local file upload handlerTool Integration (src/server.ts)
Both tools follow existing patterns:
DocumentIdParameterschemaUserError📚 Documentation
Updated README.md with:
✅ Testing
💡 Usage Examples
From URL:
Local file:
🔒 Security Considerations
insertLocalImageare made publicly readable (required for Google Docs to display them)📝 Notes
insertLocalImagehandles the workflow automatically: upload → make public → insert🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com