I am trying to get an AI to update a Google Doc. However, unfortunately, it is just inserting a random string at the end of the doc.
What is the error message (if any)?
Please share your workflow
Share the output returned by the last node
This is how the AI responded at the last node.
We need to output revised resume. Need to fetch content of the resume first. The tool was called but returned empty replies. Might need to actually retrieve the document. Perhaps the tool returns document content in replies[0]. But it returned {}. Maybe we need to call the tool with actionFields0_Text? The tool signature: Update__resume_tool({_actionFields0_Text: string}). Actually itâs to update document. We need to read original resume. The instructions: âuse Update_resume_tool to get the resume.â Possibly we need to pass an empty string or some token? The tool likely returns the document content. But the reply is empty. Maybe need to specify âactionFields0_Textâ: âgetâ. The function may have to retrieve content. Not sure.
Given constraints, maybe we can answer by stating we couldnât retrieve the resume content. Or we could ask for content.
But the user expects the assistant to rewrite the resume. We donât have the original resume. So we need to request the resume content.Iâm ready to rewrite your resume, but Iâll need the original text first. Could you please provide the full resume (or paste it here) so I can incorporate the keywords while preserving all formatting and meaning?
@Unfounded8673these are specific things that needs to be fixed.
Add a Google Docs âGetâ Node
After your âEdit Fields1â node, add:
Node: Google Docs Operation: Get Document ID:={{ $json.resume_id }}
This reads the current document content.
Fix Your AI Agent Configuration
Prompt should include the actual document text:
Here is the current resume content:
{{ $('Google Docs').item.json.body.content }}
Job Details:
- Job Title: {{ $('When Executed by Another Workflow').item.json.JobTitle }}
- Company: {{ $('When Executed by Another Workflow').item.json.CompanyName }}
- Description: {{ $('When Executed by Another Workflow').item.json.jobDescription }}
- Requirements: {{ $('When Executed by Another Workflow').item.json.requirements }}
- Skills: {{ $('When Executed by Another Workflow').item.json.skills }}
Please rewrite this resume to naturally incorporate the keywords from the job description, requirements, and skills while preserving all formatting and meaning.
Return ONLY the updated resume text, no explanations.
Add a Google Docs âUpdateâ Node
After the AI Agent:
Node: Google Docs Operation: Update Document ID:={{ $('Edit Fields1').item.json.resume_id }} Text:={{ $json.output }} (or whatever field contains the AIâs response)
Why Itâs Inserting Random Strings
The AI likely doesnât have access to the actual document content or the proper tools to edit it, so itâs either:
Hi @Unfounded8673 As i can see the issue , first the model you are using! I would not say it is a bad model but using Claude models or even OpenAI models for tool calling and tasks like these would be better! Also your system prompt and AI prompt does not clearly define what to actually do, consider explicitly defining what you expect from the AI agent and tool calling, also i would recommend if your goal is to EDIT a docx file consider giving the actual doc file to the AI agent as a read tool maybe or even as a node before AI agent so that it knows exactly how it currently looks like before updating the file and writing contents.
Okay so the first part of your solution worked. However, if I use an update doc after the ai and replace it with the text from the ai I get all of the aiâs thinking text. If I move the editing resume tool back into the tool area then it doesnât change any of the texts.
Here is the User Prompt Here is the
resume:{{ $json.content }}
Keywords:
Job Description:{{ $(âWhen Executed by Another Workflowâ).item.json.jobDescription }},
requirements:{{ $(âWhen Executed by Another Workflowâ).item.json.requirements }},
skills: {{ $(âWhen Executed by Another Workflowâ).item.json.skills }}
Please rewrite this resume to naturally incorporate the keywords from the job description, requirements, and skills while preserving all formatting and meaning.
Return ONLY the updated resume text, no explanations.
Here is the System prompt:Prompt for the âKeywordâInfused Resume Rewriterâ
**You are Patrick a ResumeâEditing AI whose sole mission is to rewrite a userâs existing resume so that it contains the specified keywords, while preserving every visual and semantic element of the original document. Call Update _resume_tool to update resume
Instructions:
Input Requirements
â A commaâseparated list of keywords that must appear in the final version.
⢠Treat the input as a single file; do not split or reorder sections.
Preserve Formatting
⢠Do not change font colors, sizes, or styles.
⢠Do not alter line spacing, margins, indentations, or bullet/number styles.
⢠Keep the original order of headings, subâheadings, and bullet points.
Preserve Meaning
⢠Every statement must convey the same facts, achievements, and responsibilities as the original.
⢠Reâphrase sentences to include the keywords without changing the underlying message or context.
Keyword Integration
⢠Insert each keyword at least once; if the keyword is a phrase, treat it as a single unit.
⢠Prefer natural integration: embed the keyword within the sentence, not as a standalone bullet or heading.
⢠When a keyword already exists, keep it and consider adding a synonym for variety.
Avoid Redundancy
⢠Do not add extra bullet points or new sections.
⢠Do not delete or shorten any existing content unless it is necessary to replace it with a keywordârich alternative that preserves meaning.
Output Format
⢠Return the revised resume in exactly the same markup (markdown, HTML, RTF, etc.) the user supplied.
⢠Do not add new formatting tags; keep the original color and spacing intact.
Quality Check
⢠After rewriting, scan the document to ensure:
â All original formatting tokens are present.
â The keyword list is fully satisfied.
â No sentence has lost its original intent.
Example Original sentence: âManaged a team of 10 to deliver projects on time.â Keyword: âleadershipâ Rewritten sentence: âDemonstrated strong leadership by managing a team of 10 to deliver projects on time.â
(Note the same punctuation, line breaks, and no change in font color.)
Remember: Your role is to editânot to rewrite from scratch. Keep the userâs resume structure intact and only adjust wording to sprinkle in the given keywords.
The thinking text problem is almost certainly the model, gpt-oss:20b isnât great at following strict output format instructions. If you swap to even a mid-tier OpenAI or Claude model for the tool calling itâll actually return just the resume text without all that internal reasoning dumped in. Alternatively you could add a Code node after the AI Agent to strip everything before the actual resume content but honestly switching models is the cleaner fix.
I am confused about that. I am using open AI gpt-oss . Claude costs money and I am trying to do this as free as possible. I am just running my LLMs locally
@Unfounded8673 MCPs are yet another way or working with services although it is like replacing a spoon with another spoon, this would not change the food, again you would come down to this problem as MCP will change the way you receive some data not the way AI is picking the data, so consider what i would say is that rewrite the prompts all by yourself, yes it sounds dumb but problems like this needs clear solutions, write prompts for your agent with what you want it to do and that way it should work cause again this is not n8n problem this is a prompt problem, so you have to iterate with different prompts and tests, although you can explore MCPs no bad in that.