@@ -542,7 +542,7 @@ func handleGetResourceLinkTool(ctx context.Context, req mcp.CallToolRequest) (*m
542542
543543 // Create a resource link pointing to an existing resource
544544 uri := fmt.Sprintf (" file://documents/%s " , resourceID)
545- resourceLink := mcp.NewResourceLink (uri, " name " , " resource name " , " file " )
545+ resourceLink := mcp.NewResourceLink (uri, " Document " , " The requested document " , " application/pdf " )
546546 return &mcp.CallToolResult {
547547 Content: []mcp.Content {
548548 mcp.NewTextContent (" Found the requested document:" ),
@@ -573,8 +573,21 @@ func handleSearchDocumentsTool(ctx context.Context, req mcp.CallToolRequest) (*m
573573 // Add resource links for each found document
574574 for _ , doc := range foundDocs {
575575 uri := fmt.Sprintf (" file://documents/%s " , doc)
576- docType := strings.Split (doc, " ." )
577- resourceLink := mcp.NewResourceLink (uri, docType[0 ], " file" , docType[1 ])
576+ parts := strings.SplitN (doc, " ." , 2 )
577+ name := parts[0 ]
578+ mimeType := " application/octet-stream" // default
579+ if len (parts) > 1 {
580+ // Map extension to MIME type (simplified)
581+ switch parts[1 ] {
582+ case " pdf" :
583+ mimeType = " application/pdf"
584+ case " txt" :
585+ mimeType = " text/plain"
586+ case " md" :
587+ mimeType = " text/markdown"
588+ }
589+ }
590+ resourceLink := mcp.NewResourceLink (uri, name, fmt.Sprintf (" Document: %s " , doc), mimeType)
578591 content = append (content, resourceLink)
579592 }
580593
@@ -598,7 +611,7 @@ func handleGetAnnotatedResourceTool(ctx context.Context, req mcp.CallToolRequest
598611 },
599612 }
600613 url := " file://documents/test.pdf"
601- resourceLink := mcp.NewResourceLink (url, " test " , " doc " , docType)
614+ resourceLink := mcp.NewResourceLink (url, " Test Document " , fmt. Sprintf ( " A %s document " , docType), " application/pdf " )
602615 resourceLink.Annotated = annotated
603616 return &mcp.CallToolResult {
604617 Content: []mcp.Content {
0 commit comments