handler:
  type: function
  runtime: nodejs
  source: tools/write_file.js
  confirm: true
definition:
  type: function
  function:
    name: write_file
    description: Write data to a file.
    parameters:
      type: object
      properties:
        file_path:
          type: string
          description: File path to write. Please provide as absolute path.
        encoding:
          type: string
          description: The encoding of the file. Default is `utf8`.
        mode:
          type: string
          description: File mode. Default is `666`.
        append:
          type: boolean
          description: If `true`, data will be appended to the file. Default is `false`.
        data:
          type: string
          description: Data to write to the file.
        cwd:
          type: string
          description: Current working directory. Default is `process.cwd()`.
      required:
        - file_path
        - data
