Skip to content

Commit 0cfb3b0

Browse files
author
klapaudius
committed
Add ProfileGeneratorTool and CollectionToolResult examples in documentation
- Updated `README.md` with `ProfileGeneratorTool` registration. - Extended `building_tools.md` to document `CollectionToolResult` usage with examples.
1 parent 7184352 commit 0cfb3b0

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Key benefits:
7272
ttl: 100
7373
tools:
7474
- KLP\KlpMcpServer\Services\ToolService\Examples\HelloWorldTool
75+
- KLP\KlpMcpServer\Services\ToolService\Examples\ProfileGeneratorTool
7576
- KLP\KlpMcpServer\Services\ToolService\Examples\StreamingDataTool
7677
- KLP\KlpMcpServer\Services\ToolService\Examples\VersionCheckTool
7778
resources:

docs/building_tools.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,19 @@ For referencing external resources:
309309
return new ResourceToolResult($resourceUri, 'application/json');
310310
```
311311

312+
#### CollectionToolResult
313+
For combining multiple tool results into a single response:
314+
315+
```php
316+
$collection = new CollectionToolResult;
317+
$collection->addItem(new TextToolResult("Operation completed successfully"));
318+
$collection->addItem(new ImageToolResult($imageData, 'image/png'));
319+
320+
return $collection;
321+
```
322+
323+
You can add any type of ToolResultInterface object to a CollectionToolResult, except another CollectionToolResult (nesting is not supported).
324+
312325
## Testing Your MCP Tools
313326

314327
### Using the Test Command

0 commit comments

Comments
 (0)