Overhaul of Resources (#125)
* Supporting resource templates with read resource callback Fixes #123 * Aligning the resource data structures with the 2024-11-05 schema - Introducing separate classes for Text and Blob ResourceContents - Custom JSON converter to allow those types to be returned, making it easier to follow the type system against the spec - Updated tests * Apply suggestions from code review Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Peder Holdgaard Pedersen <127606677+PederHP@users.noreply.github.com> * Putting files back where they belong * Adding an internal constructor to prevent overloads * Addressing feedback * Apply suggestions from code review Co-authored-by: Stephen Toub <stoub@microsoft.com> * Update src/ModelContextProtocol/Protocol/Types/ResourceContents.cs * Addressing feedback --------- Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Peder Holdgaard Pedersen <127606677+PederHP@users.noreply.github.com>
This commit is contained in:
parent
2ab9db0878
commit
3c0679e92b
1 changed files with 290 additions and 49 deletions
|
|
@ -81,7 +81,7 @@ public class Program
|
|||
Name = $"Resource {i + 1}",
|
||||
MimeType = "text/plain"
|
||||
});
|
||||
resourceContents.Add(new ResourceContents()
|
||||
resourceContents.Add(new TextResourceContents()
|
||||
{
|
||||
Uri = uri,
|
||||
MimeType = "text/plain",
|
||||
|
|
@ -97,7 +97,7 @@ public class Program
|
|||
Name = $"Resource {i + 1}",
|
||||
MimeType = "application/octet-stream"
|
||||
});
|
||||
resourceContents.Add(new ResourceContents()
|
||||
resourceContents.Add(new BlobResourceContents()
|
||||
{
|
||||
Uri = uri,
|
||||
MimeType = "application/octet-stream",
|
||||
|
|
@ -262,7 +262,7 @@ public class Program
|
|||
return Task.FromResult(new ReadResourceResult()
|
||||
{
|
||||
Contents = [
|
||||
new ResourceContents()
|
||||
new TextResourceContents()
|
||||
{
|
||||
Uri = request.Params.Uri,
|
||||
MimeType = "text/plain",
|
||||
|
|
|
|||
Loading…
Reference in a new issue