googleapis/mcp-toolbox · error

error generating SKILL.md content: %w

Error message

error generating SKILL.md content: %w

What it means

This error wraps a failure from generateSkillMarkdown, which renders the SKILL.md documentation file describing the skill and its tools. Script generation succeeded for all tools, but assembling the markdown content failed; the command logs and aborts before writing SKILL.md.

Source

Thrown at cmd/internal/skills/command.go:230

			scriptContent, err := generateScriptContent(toolName, configArgsStr, cmd.licenseHeader, cmd.invocationMode, cmd.toolboxVersion, parser.OptionalEnvVars)
			if err != nil {
				errMsg := fmt.Errorf("error generating script content for %s: %w", toolName, err)
				opts.Logger.ErrorContext(ctx, errMsg.Error())
				return errMsg
			}

			scriptFilename := filepath.Join(scriptsPath, fmt.Sprintf("%s.js", toolName))
			if err := os.WriteFile(scriptFilename, []byte(scriptContent), 0755); err != nil {
				errMsg := fmt.Errorf("error writing script %s: %w", scriptFilename, err)
				opts.Logger.ErrorContext(ctx, errMsg.Error())
				return errMsg
			}
		}

		// Generate SKILL.md
		skillContent, err := generateSkillMarkdown(skillName, content.description, cmd.additionalNotes, allTools, parser.EnvVars)
		if err != nil {
			errMsg := fmt.Errorf("error generating SKILL.md content: %w", err)
			opts.Logger.ErrorContext(ctx, errMsg.Error())
			return errMsg
		}
		skillMdPath := filepath.Join(skillPath, "SKILL.md")
		if err := os.WriteFile(skillMdPath, []byte(skillContent), 0644); err != nil {
			errMsg := fmt.Errorf("error writing SKILL.md: %w", err)
			opts.Logger.ErrorContext(ctx, errMsg.Error())
			return errMsg
		}

		opts.Logger.InfoContext(ctx, fmt.Sprintf("Successfully generated skill '%s' with %d tools.", skillName, len(allTools)))
	}

	return nil
}

// resolveSkillName returns the explicit --name when set. Otherwise, in the
// single-skill modes it defaults to the --group or --toolset name, and for

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Re-run the command to confirm determinism and inspect which skill/tools were being processed
  2. Check the --additional-notes value and the config's tool descriptions for malformed or problematic content
  3. Regenerate with fewer tools (--tools/--toolset) to isolate the tool whose metadata breaks rendering
  4. Update the toolbox binary to the latest patch version
  5. If persistent, file an issue with the failing config (redacted) for the maintainers

Example fix

// before
toolbox skills --name my-skill --toolset all --additional-notes "$(cat notes.txt)"
// after (validate the notes input is plain text)
toolbox skills --name my-skill --tools list_tables,execute_sql --additional-notes "Use read-only queries."
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate inputs to markdown generation before running
text Notes; // ensure --additional-notes is plain UTF-8 text
if [ -n "$NOTES" ] && ! printf '%s' "$NOTES" | iconv -f utf-8 -t utf-8 >/dev/null 2>&1; then
  echo "--additional-notes must be valid UTF-8"; exit 1
fi

Try / catch

try {
  execSync("toolbox skills --name my-skill", { stdio: "inherit" });
} catch (e) {
  if (String(e.stderr).includes("error generating SKILL.md content")) {
    console.error("SKILL.md rendering failed; reduce toolset or check --additional-notes:", e.stderr);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Running `toolbox skills` when generateSkillMarkdown(skillName, content.description, cmd.additionalNotes, allTools, parser.EnvVars) returns an error — e.g. template execution failure while rendering tool descriptions, env var tables, or additional notes into the markdown template.

Common situations: A tool whose description or parameter metadata contains content the markdown template cannot render; a config with unusual --additional-notes input; a toolset mixing tools from mismatched config versions producing unexpected data shapes passed to the template.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/3d24d9fb61e878c8. Report an issue: GitHub.