# This file is automatically generated by ravepipeline::mcptool_build(). 
# Please never edit this file by hand!
name: ieegio-mcp_tool_volume_write
description: Write a previously cached volume (identified by its digest ID) to a temporary
  file. The volume is retrieved from session state and written in the specified format
  (NIfTI or MGZ). A temporary file is created using the volume ID as the filename.
parameters:
  type: object
  properties:
    format:
      type: string
      description: 'Output file format. Must be either "nifti" or "mgz". Defaults
        to "nifti". Example values: "nifti", "mgz"'
      enum:
      - nifti
      - mgz
      default: nifti
      examples:
      - nifti
      - mgz
    id:
      type: string
      description: 'The digest-based identifier of the cached volume. This ID is returned
        by ieegio-mcp_tool_volume_read. Example values: "a3f5e8d9c1b2", "f7e4b2a1c6d8"'
      examples:
      - a3f5e8d9c1b2
      - f7e4b2a1c6d8
  required:
  - id
category: execution
returns:
  type: object
  properties:
    error:
      type: string
      description: Character, error message if success is FALSE
    output_path:
      type: string
      description: Character, absolute path to the temporary file
    id:
      type: string
      description: Character, the volume identifier that was written
    success:
      type: boolean
      description: Logical, whether the volume was successfully written
implementation_example: |
  # Read a volume, then write it to a temporary file
  # Note: .state_env is automatically provided when called via MCP.
  # AI does not need to specify this argument. The examples only use
  # .state_env to make the code runnable for demonstration purposes.
  sample_file <- ieegio_sample_data("nifti/rnifti_example.nii.gz")
  state_env <- fastmap::fastmap()
  read_result <- ieegio:::mcp_tool_volume_read(sample_file, .state_env = state_env)
  # Write to temporary file
  ieegio:::mcp_tool_volume_write(
    id = read_result$id,
    .state_env = state_env
  )
  #
  #> $success
  #> [1] TRUE
  #> 
  #> $id
  #> [1] "e1ccd803b62bb9390d3debbd05f32042"
  #> 
  #> $output_path
  #> [1] "/private/var/folders/fm/6y447x213qxc2z95klwj20h40000gn/T/RtmpnCnMgT/ieegio/e1ccd803b62bb9390d3debbd05f32042.nii.gz"
  #>
execution_time: 0.134
