From 519ac4e2dd06f482a593bb91d1d4d995ffe234e7 Mon Sep 17 00:00:00 2001 From: Christopher Hertel Date: Fri, 7 Mar 2025 20:51:54 +0100 Subject: [PATCH] docs: add tools section --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index d021566..b96ad9a 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,23 @@ final readonly class McpController } } ``` + +### Exposing Tools + +Under the hood the SDK uses [LLM Chain](https://github.com/php-llm/llm-chain)'s `ToolBox` to register, analyze and +execute tools. In combination with its [Symfony Bundle](https://github.com/php-llm/llm-chain-bundle) you can expose +tools with `#[AsTool]` attribute. + +```php +use PhpLlm\LlmChain\ToolBox\Attribute\AsTool; + +#[AsTool('company_name', 'Provides the name of your company')] +final class CompanyName +{ + public function __invoke(): string + { + return 'ACME Corp.' + } +} +``` +See [LLM Chain Documentation](https://github.com/php-llm/llm-chain?tab=readme-ov-file#tools) for more information.