test_case_id: "mcp_audio_processing_wav_001"
description: "Tests that a base64-encoded WAV audio stream is correctly decoded and
  saved as a .wav file with an audio/wav MIME type."
tags: ["all", "agent", "mcp"]
skip_intermediate_events: true

gateway_input:
  target_agent_name: "TestAgent"
  user_identity: "mcp_audio_tester@example.com"
  parts:
    - type: "text"
      text: "Get WAV audio data."
  external_context:
    a2a_session_id: "session_mcp_audio_processing_wav_001"

llm_interactions:
  - static_response:
      choices:
        - message:
            role: "assistant"
            tool_calls:
              - id: "call_mcp_tool_wav"
                type: "function"
                function:
                  name: "get_data_stdio"
                  # A very short, silent WAV file
                  arguments: '{"response_to_return": {"content": [{"type": "audio",
                    "data": "UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABgAAABkYXRhAAAAAA==",
                    "mimeType": "audio/wav"}]}}'
  - expected_request:
      expected_tool_responses_in_llm_messages:
        - tool_name: "get_data_stdio"
          response_json_matches:
            status: "processed_and_saved"
            message_to_llm_matches_regex: "The full response has been saved as artifact
              'get_data_stdio_audio_0_.*\\.wav' \\(version 0\\)\\."
            saved_mcp_response_artifact_details:
              status: "success"
              artifacts_saved:
                - data_filename_matches_regex: "get_data_stdio_audio_0_.*\\.wav"
                  status: "success"
    static_response:
      choices:
        - message:
            role: "assistant"
            content: "I have retrieved the WAV audio and saved it as an artifact."

expected_gateway_output:
  - type: "final_response"
    kind: task
    id: '*'
    contextId: "session_mcp_audio_processing_wav_001"
    status:
      state: completed
      message:
        kind: message
        messageId: '*'
        role: agent
        parts:
          - type: "text"
            text_exact: "I have retrieved the WAV audio and saved it as an artifact."
    assert_artifact_state:
      - filename_matches_regex: "get_data_stdio_audio_0_.*\\.wav$"
        version: 0
        expected_content_bytes_base64: "UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABgAAABkYXRhAAAAAA=="
        expected_metadata_contains:
          source_tool_name: "get_data_stdio"
          content_type: "audio"
          original_mime_type: "audio/wav"
