McpAppCommandBuilderExtensions
Extension methods for linking Repl commands to MCP App UI resources.
- Kind:
Class - Namespace: Repl.Mcp
- Assembly:
Repl.Mcp - Source: src/Repl.Mcp/McpAppCommandBuilderExtensions.cs
Signature
Section titled “Signature”public static class McpAppCommandBuilderExtensionsInheritance
Section titled “Inheritance”Methods
Section titled “Methods”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)Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder): Command builder.resourceUri(string): Theui://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.
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder): Command builder.resourceUri(string): Theui://resource rendered for this command.visibility(McpAppVisibility): Whether the tool is visible to the model, the app iframe, or both.
Returns
Section titled “Returns”CommandBuilder - The same builder instance.
WithMcpAppBorder(CommandBuilder, bool)
Section titled “WithMcpAppBorder(CommandBuilder, bool)”Sets the visual boundary preference for the MCP App.
public static CommandBuilder WithMcpAppBorder(this CommandBuilder builder, bool prefersBorder = true)Parameters
Section titled “Parameters”builder(CommandBuilder)prefersBorder(bool)
Returns
Section titled “Returns”WithMcpAppCsp(CommandBuilder, McpAppCsp)
Section titled “WithMcpAppCsp(CommandBuilder, McpAppCsp)”Sets the Content Security Policy metadata for the MCP App.
public static CommandBuilder WithMcpAppCsp(this CommandBuilder builder, McpAppCsp csp)Parameters
Section titled “Parameters”builder(CommandBuilder)csp(McpAppCsp)
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder)displayMode(string)
Returns
Section titled “Returns”WithMcpAppDomain(CommandBuilder, string)
Section titled “WithMcpAppDomain(CommandBuilder, string)”Sets a host-specific dedicated domain hint for the MCP App.
public static CommandBuilder WithMcpAppDomain(this CommandBuilder builder, string domain)Parameters
Section titled “Parameters”builder(CommandBuilder)domain(string)
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder)text(string)
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder)permissions(McpAppPermissions)
Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”builder(CommandBuilder)key(string)value(string)