Skip to content

Commit 978d4ca

Browse files
Add documentation for explicitly setting tool annotation values (#10956)
* Add documentation for explicitly setting tool annotation values * docs: document explicit boolean values for tool annotations * Remove annotation values section from mcp.md Removed section on explicitly setting annotation values and adjusted formatting. --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent 0a53159 commit 978d4ca

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

mcp.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,25 @@ Available annotations include:
494494
| `#[IsIdempotent]` | boolean | Indicates repeated calls with same arguments have no additional effect (when not read-only). |
495495
| `#[IsOpenWorld]` | boolean | Indicates the tool may interact with external entities. |
496496

497+
Annotation values can be explicitly set using boolean arguments:
498+
499+
```php
500+
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
501+
use Laravel\Mcp\Server\Tools\Annotations\IsDestructive;
502+
use Laravel\Mcp\Server\Tools\Annotations\IsOpenWorld;
503+
use Laravel\Mcp\Server\Tools\Annotations\IsIdempotent;
504+
use Laravel\Mcp\Server\Tool;
505+
506+
#[IsReadOnly(true)]
507+
#[IsDestructive(false)]
508+
#[IsOpenWorld(false)]
509+
#[IsIdempotent(true)]
510+
class CurrentWeatherTool extends Tool
511+
{
512+
//
513+
}
514+
```
515+
497516
<a name="conditional-tool-registration"></a>
498517
### Conditional Tool Registration
499518

0 commit comments

Comments
 (0)