Skip to content

Commit f606274

Browse files
committed
add optional resource annotations
1 parent c94ba4b commit f606274

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/types.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,28 @@ export const BlobResourceContentsSchema = ResourceContentsSchema.extend({
518518
blob: Base64Schema,
519519
});
520520

521+
/**
522+
* Optional annotations providing clients additional context about a resource.
523+
*/
524+
export const ResourceAnnotationsSchema = z
525+
.object({
526+
/**
527+
* Intended audience(s) for the resource.
528+
*/
529+
audience: z.optional(z.array(z.enum(["user", "assistant"]))),
530+
531+
/**
532+
* Importance hint for the resource, from 0 (least) to 1 (most).
533+
*/
534+
priority: z.optional(z.number().min(0).max(1)),
535+
536+
/**
537+
* ISO 8601 timestamp for the most recent modification.
538+
*/
539+
lastModified: z.optional(z.string().datetime({ offset: true })),
540+
})
541+
.passthrough();
542+
521543
/**
522544
* A known resource that the server is capable of reading.
523545
*/
@@ -539,6 +561,11 @@ export const ResourceSchema = BaseMetadataSchema.extend({
539561
*/
540562
mimeType: z.optional(z.string()),
541563

564+
/**
565+
* Optional annotations for the client.
566+
*/
567+
annotations: z.optional(ResourceAnnotationsSchema),
568+
542569
/**
543570
* An optional list of icons for this resource.
544571
*/
@@ -1608,6 +1635,7 @@ export type PaginatedResult = Infer<typeof PaginatedResultSchema>;
16081635
export type ResourceContents = Infer<typeof ResourceContentsSchema>;
16091636
export type TextResourceContents = Infer<typeof TextResourceContentsSchema>;
16101637
export type BlobResourceContents = Infer<typeof BlobResourceContentsSchema>;
1638+
export type ResourceAnnotations = Infer<typeof ResourceAnnotationsSchema>;
16111639
export type Resource = Infer<typeof ResourceSchema>;
16121640
export type ResourceTemplate = Infer<typeof ResourceTemplateSchema>;
16131641
export type ListResourcesRequest = Infer<typeof ListResourcesRequestSchema>;

0 commit comments

Comments
 (0)