Skip to content

Commit bebec50

Browse files
committed
Updates MCP
1 parent bd4a1d6 commit bebec50

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

app/Http/Controllers/McpController.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function message(Request $request): JsonResponse
7171

7272
try {
7373
$result = match ($method) {
74+
'initialize' => $this->handleInitialize($params),
75+
'notifications/initialized' => new \stdClass,
76+
'ping' => new \stdClass,
7477
'tools/list' => ['tools' => $this->getToolDefinitions()],
7578
'tools/call' => $this->handleToolCall($params['name'] ?? '', $params['arguments'] ?? []),
7679
default => throw new \InvalidArgumentException("Unknown method: {$method}"),
@@ -238,6 +241,20 @@ protected function getToolDefinitions(): array
238241
];
239242
}
240243

244+
protected function handleInitialize(array $params): array
245+
{
246+
return [
247+
'protocolVersion' => '2024-11-05',
248+
'capabilities' => [
249+
'tools' => new \stdClass,
250+
],
251+
'serverInfo' => [
252+
'name' => 'nativephp-docs',
253+
'version' => '1.0.0',
254+
],
255+
];
256+
}
257+
241258
protected function handleToolCall(string $name, array $args): array
242259
{
243260
return match ($name) {

0 commit comments

Comments
 (0)