AI not editing google Docs

Describe the problem/error/question

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?

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
1 Like

@Unfounded8673 these 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:

  • Hallucinating content

  • Returning placeholder text

  • Not understanding what it’s supposed to do

1 Like

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

  7. 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

Hi @Unfounded8673 Consider using gpt 4o model for better tool calling abilities, that would really work! Gpt-oss is just not capable enough.

Is there a model that Ollama has that I could use that would work better? I am trying to run everything locally

what part of the solution has worked so far?

Hi @Unfounded8673 Consider reading this document:

Also my personal advice is to always use Claude or OpenAI models as they work all the time and would not cause trouble in production.

Hi @kalany Welcome! I guess using a stronger model like OpenAI’s GPT-4o would be a better take for this entire problem, also a good system prompt.

Everything works other than the AI not doing what I want it to do. Would a MCP work as a work around to this problem?

1 Like

@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.