11
11
/**
12
12
* @phpstan-import-type McpToolNamesFilterType from McpToolNamesFilter
13
13
*
14
- * @phpstan-type RemoteMcpToolType array{type: 'mcp', server_label: string, server_url: string, require_approval: 'never'|'always'|array<'never'|'always', McpToolNamesFilterType>|null, allowed_tools: array<int, string>|McpToolNamesFilterType|null, headers: array<string, string>|null}
14
+ * @phpstan-type RemoteMcpToolType array{type: 'mcp', server_label: string, authorization: string|null, connector_id?: string|null, server_url: string|null , require_approval: 'never'|'always'|array<'never'|'always', McpToolNamesFilterType>|null, allowed_tools: array<int, string>|McpToolNamesFilterType|null, headers: array<string, string>|null, server_description?: string |null}
15
15
*
16
16
* @implements ResponseContract<RemoteMcpToolType>
17
17
*/
@@ -33,10 +33,13 @@ final class RemoteMcpTool implements ResponseContract
33
33
private function __construct (
34
34
public readonly string $ type ,
35
35
public readonly string $ serverLabel ,
36
- public readonly string $ serverUrl ,
36
+ public readonly ? string $ serverUrl = null ,
37
37
public readonly string |array |null $ requireApproval = null ,
38
38
public readonly array |McpToolNamesFilter |null $ allowedTools = null ,
39
39
public readonly ?array $ headers = null ,
40
+ public readonly ?string $ connectorId = null ,
41
+ public readonly ?string $ authorization = null ,
42
+ public readonly ?string $ serverDescription = null ,
40
43
) {}
41
44
42
45
/**
@@ -59,10 +62,13 @@ public static function from(array $attributes): self
59
62
return new self (
60
63
type: $ attributes ['type ' ],
61
64
serverLabel: $ attributes ['server_label ' ],
62
- serverUrl: $ attributes ['server_url ' ],
65
+ serverUrl: $ attributes ['server_url ' ] ?? null ,
63
66
requireApproval: $ requireApproval ,
64
67
allowedTools: $ allowedTools , // @phpstan-ignore-line
65
68
headers: $ attributes ['headers ' ] ?? null ,
69
+ connectorId: $ attributes ['connector_id ' ] ?? null ,
70
+ authorization: $ attributes ['authorization ' ] ?? null ,
71
+ serverDescription: $ attributes ['server_description ' ] ?? null ,
66
72
);
67
73
}
68
74
@@ -90,6 +96,9 @@ public function toArray(): array
90
96
'require_approval ' => $ requireApproval ,
91
97
'allowed_tools ' => $ allowedTools ,
92
98
'headers ' => $ this ->headers ,
99
+ 'connector_id ' => $ this ->connectorId ,
100
+ 'authorization ' => $ this ->authorization ,
101
+ 'server_description ' => $ this ->serverDescription ,
93
102
];
94
103
}
95
104
}
0 commit comments