Skip to content

McpAppCommandBuilderExtensions

Extension methods for linking Repl commands to MCP App UI resources.

public static class McpAppCommandBuilderExtensions

AsMcpAppResource(CommandBuilder, McpAppVisibility, string?)

Section titled “AsMcpAppResource(CommandBuilder, McpAppVisibility, string?)”

Marks this command as an MCP App UI resource and links the command’s tool declaration to it. The ui:// resource URI is generated from the command route. The handler return value should be a complete HTML document.

public static CommandBuilder AsMcpAppResource(this CommandBuilder builder, McpAppVisibility visibility = McpAppVisibility.ModelAndApp, string? preferredDisplayMode = null)
  • builder (CommandBuilder): Command builder.
  • visibility (McpAppVisibility): Whether the linked tool is visible to the model, the app iframe, or both.
  • preferredDisplayMode (string): Optional preferred display mode. Hosts decide whether they support it.

CommandBuilder - The same builder instance.

AsMcpAppResource(CommandBuilder, string, McpAppVisibility, string?)

Section titled “AsMcpAppResource(CommandBuilder, string, McpAppVisibility, string?)”

Marks this command as an MCP App UI resource and links the command’s tool declaration to it. The handler return value should be a complete HTML document.

public static CommandBuilder AsMcpAppResource(this CommandBuilder builder, string resourceUri, McpAppVisibility visibility = McpAppVisibility.ModelAndApp, string? preferredDisplayMode = null)
  • builder (CommandBuilder): Command builder.
  • resourceUri (string): The ui:// resource URI.
  • visibility (McpAppVisibility): Whether the linked tool is visible to the model, the app iframe, or both.
  • preferredDisplayMode (string): Optional preferred display mode. Hosts decide whether they support it.

CommandBuilder - The same builder instance.

WithMcpApp(CommandBuilder, string, McpAppVisibility)

Section titled “WithMcpApp(CommandBuilder, string, McpAppVisibility)”

Links a command to an MCP App UI resource.

public static CommandBuilder WithMcpApp(this CommandBuilder builder, string resourceUri, McpAppVisibility visibility = McpAppVisibility.ModelAndApp)
  • builder (CommandBuilder): Command builder.
  • resourceUri (string): The ui:// resource rendered for this command.
  • visibility (McpAppVisibility): Whether the tool is visible to the model, the app iframe, or both.

CommandBuilder - The same builder instance.

Sets the visual boundary preference for the MCP App.

public static CommandBuilder WithMcpAppBorder(this CommandBuilder builder, bool prefersBorder = true)

CommandBuilder

Sets the Content Security Policy metadata for the MCP App.

public static CommandBuilder WithMcpAppCsp(this CommandBuilder builder, McpAppCsp csp)

CommandBuilder

WithMcpAppDisplayMode(CommandBuilder, string)

Section titled “WithMcpAppDisplayMode(CommandBuilder, string)”

Sets the preferred display mode for hosts that support display mode changes.

public static CommandBuilder WithMcpAppDisplayMode(this CommandBuilder builder, string displayMode)

CommandBuilder

Sets a host-specific dedicated domain hint for the MCP App.

public static CommandBuilder WithMcpAppDomain(this CommandBuilder builder, string domain)

CommandBuilder

WithMcpAppLauncherText(CommandBuilder, string)

Section titled “WithMcpAppLauncherText(CommandBuilder, string)”

Sets the fallback text returned when the MCP App launcher tool is called.

public static CommandBuilder WithMcpAppLauncherText(this CommandBuilder builder, string text)

CommandBuilder

WithMcpAppPermissions(CommandBuilder, McpAppPermissions)

Section titled “WithMcpAppPermissions(CommandBuilder, McpAppPermissions)”

Sets browser permission metadata for the MCP App.

public static CommandBuilder WithMcpAppPermissions(this CommandBuilder builder, McpAppPermissions permissions)

CommandBuilder

WithMcpAppUiMetadata(CommandBuilder, string, string)

Section titled “WithMcpAppUiMetadata(CommandBuilder, string, string)”

Adds a host-specific UI metadata value.

public static CommandBuilder WithMcpAppUiMetadata(this CommandBuilder builder, string key, string value)

CommandBuilder