Skip to content

Commit 6cea952

Browse files
author
klapaudius
committed
Add resource stub implementing ResourceInterface
Create a new resource stub template for generating classes that implement the `ResourceInterface`. Includes methods to retrieve resource metadata such as URI, name, description, MIME type, data, and size.
1 parent da8a6ba commit 6cea952

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/stubs/resource.stub

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace {{ namespace }};
4+
5+
use KLP\KlpMcpServer\Services\ResourceService\ResourceInterface;
6+
7+
class {{ className }} implements ResourceInterface
8+
{
9+
public function getUri(): string
10+
{
11+
return "file:/my-resource.txt";
12+
}
13+
14+
public function getName(): string
15+
{
16+
return "my-resource.txt";
17+
}
18+
19+
public function getDescription(): string
20+
{
21+
return "My resource.";
22+
}
23+
24+
public function getMimeType(): string
25+
{
26+
return "text/plain";
27+
}
28+
29+
public function getData(): string
30+
{
31+
return "My Resource";
32+
}
33+
34+
public function getSize(): int
35+
{
36+
return strlen($this->getData());
37+
}
38+
}

0 commit comments

Comments
 (0)