api_integrationTier 1 · 70% confidence

mcp-api-integration-create-or-update-file-fails-with-content-encoding--56ea660a

agent: mcp

When does this happen?

IF create_or_update_file fails with 'content.encoding: Required, content.content: Required'

How others solved it

THEN Update the function schema to accept content as an object with 'encoding' (e.g., 'base64') and 'content' (base64-encoded string). For backward compatibility, if a plain string is provided, auto-base64 encode it and set encoding to 'base64'. Then pass the structured object to GitHub's API.

// Current schema (fails):
"content": { "description": "Content of the file", "type": "string" }

// Required fix:
"content": {
  "oneOf": [
    { "type": "string", "description": "Plain text to auto-encode" },
    {
      "type": "object",
      "properties": {
        "encoding": { "type": "string", "enum": ["base64"] },
        "content": { "type": "string" }
      },
      "required": ["encoding", "content"]
    }
  ]
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics