diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb42be8..d60e50f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,13 @@ jobs: os: [ubuntu-latest, windows-latest] php-version: [8.2, 8.3, 8.4, 8.5] prefer-lowest: [''] + exclude: + - os: windows-latest + php-version: 8.3 + - os: windows-latest + php-version: 8.4 + - os: windows-latest + php-version: 8.5 include: - php-version: '8.2' os: ubuntu-latest diff --git a/composer.json b/composer.json index 7e21b9b..5288b15 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ "require": { "php": ">=8.2", "cakephp/cakephp": "^5.2", - "mcp/sdk": "^0.3", + "mcp/sdk": "^0.4", "ext-sqlite3": "*" }, "require-dev": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 9f282ef..c9ac8fb 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -7,7 +7,6 @@ > - diff --git a/src/Resources/DocumentationResources.php b/src/Resources/DocumentationResources.php index 3df53fd..a0a6f06 100644 --- a/src/Resources/DocumentationResources.php +++ b/src/Resources/DocumentationResources.php @@ -72,7 +72,7 @@ public function searchResource(string $query): TextResourceContents ); } catch (Exception $exception) { $message = sprintf('Failed to read documentation resource: %s', $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } @@ -124,7 +124,7 @@ public function contentResource(string $docId): TextResourceContents throw $exception; } catch (Exception $exception) { $message = sprintf('Failed to read documentation resource: %s', $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } diff --git a/src/Tools/DatabaseTools.php b/src/Tools/DatabaseTools.php index 7e9b68b..1bd8a03 100644 --- a/src/Tools/DatabaseTools.php +++ b/src/Tools/DatabaseTools.php @@ -59,7 +59,7 @@ public function listConnections(): array ]; } catch (Exception $e) { $message = sprintf("Failed to get connection info for '%s': %s", $name, $e->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $e->getCode(), $e); } } @@ -113,7 +113,7 @@ public function describeSchema(string $connection = 'default', ?string $table = ]; } catch (Exception $exception) { $message = sprintf("Failed to read schema for connection '%s': %s", $connection, $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } diff --git a/src/Tools/DocumentationTools.php b/src/Tools/DocumentationTools.php index 91195cd..12c5971 100644 --- a/src/Tools/DocumentationTools.php +++ b/src/Tools/DocumentationTools.php @@ -94,7 +94,7 @@ public function searchDocs( ]; } catch (Exception $exception) { $message = sprintf('Failed to search documentation: %s', $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } @@ -116,7 +116,7 @@ public function getStats(): array return $this->searchService->getStatistics(); } catch (Exception $exception) { $message = sprintf('Failed to get documentation statistics: %s', $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } @@ -164,7 +164,7 @@ public function getDocument(string $docId): array throw $exception; } catch (Exception $exception) { $message = sprintf('Failed to get document: %s', $exception->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $exception->getCode(), $exception); } } } diff --git a/src/Tools/RouteTools.php b/src/Tools/RouteTools.php index e2ab77b..8f01c39 100644 --- a/src/Tools/RouteTools.php +++ b/src/Tools/RouteTools.php @@ -174,10 +174,10 @@ public function matchUrl(string $url, string $method = 'GET'): array ]; } catch (MissingRouteException $e) { $message = sprintf("No route matches URL '%s' with method '%s': %s", $url, $method, $e->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $e->getCode(), $e); } catch (Exception $e) { $message = sprintf("Error parsing URL '%s': %s", $url, $e->getMessage()); - throw new ToolCallException($message); + throw new ToolCallException($message, $e->getCode(), $e); } }