diff --git a/docs/run/server-builder.md b/docs/run/server-builder.md index 017d4a8d..c1337674 100644 --- a/docs/run/server-builder.md +++ b/docs/run/server-builder.md @@ -114,16 +114,20 @@ use Mcp\Server\Wire\CachePolicy; $server = Server::builder() // Signs the state a multi round-trip request carries through the client. // The same key must reach every process that might serve the retry. + // The key needs at least 32 bytes, otherwise build() throws. TTL in seconds, default 600. + // Without a key, the server refuses every state the client sends back. ->setRequestState($_ENV['MCP_REQUEST_STATE_KEY'], ttl: 600) // Bounds the input-required shim, which fulfils an `InputRequiredResult` // over a handshake-era connection. `withoutInputRequiredShim()` turns it off. + // Defaults to 8 rounds and a 600 second timeout for each input request. ->setInputRequiredLimits(maxRounds: 4, roundTimeout: 120) // Caching hints stamped on cacheable results. Defaults to `ttlMs: 0, private`. ->setCachePolicy(CachePolicy::default(30_000)->withMethod('tools/list', 3_600_000, CacheScope::Public)) // Delivery for `subscriptions/listen`, and how long such a stream is held. + // The lifetime defaults to 30 seconds; 0 keeps the stream open until the client or the runtime ends it. ->setNotificationBus(new Psr16NotificationBus($cache)) ->setSubscriptionLifetime(0) diff --git a/docs/servers/tools.md b/docs/servers/tools.md index 258039f3..ea56d45b 100644 --- a/docs/servers/tools.md +++ b/docs/servers/tools.md @@ -4,6 +4,7 @@ Tools are callable functions that perform actions and return results. ```php use Mcp\Capability\Attribute\McpTool; +use Mcp\Exception\ToolCallException; class Calculator { @@ -17,8 +18,8 @@ class Calculator 'add' => $a + $b, 'subtract' => $a - $b, 'multiply' => $a * $b, - 'divide' => $b != 0 ? $a / $b : throw new \InvalidArgumentException('Division by zero'), - default => throw new \InvalidArgumentException('Invalid operation') + 'divide' => $b != 0 ? $a / $b : throw new ToolCallException('Division by zero'), + default => throw new ToolCallException('Invalid operation') }; } }