@@ -59,7 +59,6 @@ async def get_image_resource() -> EmbeddedResource:
59
59
60
60
61
61
@mcp .tool ()
62
- @mcp .resource (Path (__file__ ).parent .joinpath ('assets/kiwi.png' ).absolute ().as_uri ())
63
62
async def get_image_resource_link () -> ResourceLink :
64
63
return ResourceLink (
65
64
type = 'resource_link' ,
@@ -68,6 +67,11 @@ async def get_image_resource_link() -> ResourceLink:
68
67
)
69
68
70
69
70
+ @mcp .resource ('resource://kiwi.png' , mime_type = 'image/png' )
71
+ async def kiwi_resource () -> bytes :
72
+ return Path (__file__ ).parent .joinpath ('assets/kiwi.png' ).read_bytes ()
73
+
74
+
71
75
@mcp .tool ()
72
76
async def get_audio_resource () -> EmbeddedResource :
73
77
data = Path (__file__ ).parent .joinpath ('assets/marcelo.mp3' ).read_bytes ()
@@ -82,7 +86,6 @@ async def get_audio_resource() -> EmbeddedResource:
82
86
83
87
84
88
@mcp .tool ()
85
- @mcp .resource (Path (__file__ ).parent .joinpath ('assets/marcelo.mp3' ).absolute ().as_uri ())
86
89
async def get_audio_resource_link () -> ResourceLink :
87
90
return ResourceLink (
88
91
type = 'resource_link' ,
@@ -91,6 +94,11 @@ async def get_audio_resource_link() -> ResourceLink:
91
94
)
92
95
93
96
97
+ @mcp .resource ('resource://marcelo.mp3' , mime_type = 'audio/mpeg' )
98
+ async def marcelo_resource () -> bytes :
99
+ return Path (__file__ ).parent .joinpath ('assets/marcelo.mp3' ).read_bytes ()
100
+
101
+
94
102
@mcp .tool ()
95
103
async def get_product_name () -> EmbeddedResource :
96
104
return EmbeddedResource (
@@ -103,7 +111,6 @@ async def get_product_name() -> EmbeddedResource:
103
111
104
112
105
113
@mcp .tool ()
106
- @mcp .resource (Path (__file__ ).parent .joinpath ('assets/product_name.txt' ).absolute ().as_uri ())
107
114
async def get_product_name_link () -> ResourceLink :
108
115
return ResourceLink (
109
116
type = 'resource_link' ,
@@ -112,6 +119,11 @@ async def get_product_name_link() -> ResourceLink:
112
119
)
113
120
114
121
122
+ @mcp .resource ('resource://product_name.txt' , mime_type = 'text/plain' )
123
+ async def product_name_resource () -> str :
124
+ return Path (__file__ ).parent .joinpath ('assets/product_name.txt' ).read_text ()
125
+
126
+
115
127
@mcp .tool ()
116
128
async def get_image () -> Image :
117
129
data = Path (__file__ ).parent .joinpath ('assets/kiwi.png' ).read_bytes ()
0 commit comments