Skip to contents

A tool tagged @mcpReturns content returns a list of these blocks, sent as they are in the content of its result: text, an image, audio, a link to a resource, or an embedded resource, each with optional annotations.

Usage

content_text(text, annotations = NULL)

content_image(x, mime_type = NULL, annotations = NULL)

content_audio(path, mime_type = NULL, annotations = NULL)

content_resource_link(
  uri,
  name,
  title = NULL,
  description = NULL,
  mime_type = NULL,
  size = NULL,
  annotations = NULL
)

content_resource(
  uri,
  text = NULL,
  blob = NULL,
  mime_type = NULL,
  annotations = NULL
)

content_annotations(audience = NULL, priority = NULL, last_modified = NULL)

Arguments

text

Character vector, one element per line.

annotations

content_annotations(), or NULL.

x

A ggplot, a recorded plot, or the path to an image file.

mime_type

MIME type, guessed from the file extension when NULL.

path

Path to an audio file.

uri

URI of the resource.

name, title, description

Name, display name and description of the resource.

size

Size of the resource in bytes.

blob

Raw vector, the binary content of the resource.

audience

Who the block is for: "user", "assistant" or both.

priority

How important the block is, from 0 to 1.

last_modified

When it last changed: a date-time, or an ISO 8601 string.

Value

A content block, or for content_annotations() the annotations of one.

Examples

content_text(
  "Three runs this week.",
  annotations = content_annotations(
    audience = "user",
    priority = 1
  )
)
#> $type
#> [1] "text"
#> 
#> $text
#> [1] "Three runs this week."
#> 
#> $annotations
#> $annotations$audience
#> $annotations$audience[[1]]
#> [1] "user"
#> 
#> 
#> $annotations$priority
#> [1] 1
#> 
#> 
#> attr(,"class")
#> [1] "mordew_content"
content_resource_link(
  "runlog://surfaces",
  "surfaces"
)
#> $type
#> [1] "resource_link"
#> 
#> $uri
#> [1] "runlog://surfaces"
#> 
#> $name
#> [1] "surfaces"
#> 
#> attr(,"class")
#> [1] "mordew_content"