MCP PHP SDK

AudioContent extends Content

Represents audio content in MCP.

Tags
phpstan-import-type

AnnotationsData from Annotations

author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Properties

$annotations  : Annotations|null
$data  : string
$mimeType  : string
$type  : string

Methods

__construct()  : mixed
fromArray()  : self
fromFile()  : self
Create a new AudioContent from a file path.
fromString()  : self
Create a new AudioContent from a string.
jsonSerialize()  : Annotations}

Properties

Methods

__construct()

public __construct(string $data, string $mimeType[, Annotations|null $annotations = null ]) : mixed
Parameters
$data : string
$mimeType : string
$annotations : Annotations|null = null

fromArray()

public static fromArray(AudioContentData $data) : self
Parameters
$data : AudioContentData
Return values
self

fromFile()

Create a new AudioContent from a file path.

public static fromFile(string $path[, string|null $mimeType = null ][, Annotations|null $annotations = null ]) : self
Parameters
$path : string

Path to the audio file

$mimeType : string|null = null

Optional MIME type override

$annotations : Annotations|null = null

Optional annotations describing the content

Tags
throws
InvalidArgumentException

If the file doesn't exist

Return values
self

fromString()

Create a new AudioContent from a string.

public static fromString(string $data, string $mimeType[, Annotations|null $annotations = null ]) : self
Parameters
$data : string

The audio data

$mimeType : string

MIME type of the audio

$annotations : Annotations|null = null

Optional annotations describing the content

Return values
self

jsonSerialize()

public jsonSerialize() : Annotations}
Return values
Annotations}

        
On this page

Search results