MCP PHP SDK

Tool
in package
implements JsonSerializable

Definition for a tool the client can call.

Tags
phpstan-import-type

ToolAnnotationsData from ToolAnnotations

phpstan-import-type

IconData from Icon

phpstan-type

ToolInputSchema array{ type: 'object', properties: array<string, mixed>, required: string[]|null }

phpstan-type

ToolData array{ name: string, inputSchema: ToolInputSchema, description?: string|null, annotations?: ToolAnnotationsData, icons?: IconData[], _meta?: array<string, mixed> }

author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Interfaces

JsonSerializable

Properties

$annotations  : ToolAnnotations|null
$description  : string|null
$icons  : array<string|int, mixed>|null
$inputSchema  : array<string|int, mixed>
$meta  : array<string|int, mixed>|null
$name  : string

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : Icon[], _meta?: array}

Properties

$description read-only

public string|null $description

$icons read-only

public array<string|int, mixed>|null $icons = null

$inputSchema read-only

public array<string|int, mixed> $inputSchema

$meta read-only

public array<string|int, mixed>|null $meta = null

$name read-only

public string $name

Methods

__construct()

public __construct(string $name, ToolInputSchema $inputSchema, string|null $description, ToolAnnotations|null $annotations[, array<string|int, Icon>|null $icons = null ][, array<string, mixed>|null $meta = null ]) : mixed
Parameters
$name : string

the name of the tool

$inputSchema : ToolInputSchema

a JSON Schema object (as a PHP array) defining the expected 'arguments' for the tool

$description : string|null

A human-readable description of the tool. This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model.

$annotations : ToolAnnotations|null

optional additional tool information

$icons : array<string|int, Icon>|null = null

optional icons representing the tool

$meta : array<string, mixed>|null = null

Optional metadata

fromArray()

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

jsonSerialize()

public jsonSerialize() : Icon[], _meta?: array}
Return values
Icon[], _meta?: array}

        
On this page

Search results