Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/frontend/src/content/docs/dashboard/explore.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,15 @@ Selecting **View response** opens the text visualizer with the command's result

<Image src={notificationCenterResponse} alt="Aspire dashboard text visualizer showing a command response opened from the notification center." />

Markdown command results render as formatted Markdown in the text visualizer (for example, headings and tables), not as raw markdown source.

The unread count resets when you open the notification center. To clear all notifications, select the **Dismiss all** button in the dialog.

<Aside type="tip">
Notifications are capped at 100 entries. When the limit is reached, the oldest notifications are removed automatically.
</Aside>

For information on returning messages from custom commands, see [Custom resource commands](/fundamentals/custom-resource-commands/).
For information on returning command result payloads from custom commands, see [Custom resource commands](/fundamentals/custom-resource-commands/).

## Settings dialog

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ return { success: false, message: err instanceof Error ? err.message : String(er
</TabItem>
</Tabs>

## Return structured output from a command
## Returning a result from a command

Resource commands can return a structured payload — plain text, JSON, or Markdown — alongside the success/failure signal. The payload flows automatically through the entire Aspire pipeline:

Expand Down Expand Up @@ -826,6 +826,47 @@ await builder.build().run();
</TabItem>
</Tabs>

### Return Markdown

When a command needs rich output (for example headings, tables, and lists), return `CommandResultData` with `Format = CommandResultFormat.Markdown`:

```csharp title="C# — AppHost.cs"
builder
.AddProject<Projects.MyService>("myservice")
.WithCommand(
name: "migrate-database",
displayName: "Migrate Database",
executeCommand: _ =>
{
var markdown = """
# ⚙️ Database Migration Summary

| Table | Result |
|------------|----------------------------|
| Customers | ✅ 1,200 rows |
| Products | ✅ 850 rows |
| Orders | ✅ 3,400 rows |
| OrderItems | ✅ 8,750 rows |
| Categories | ✅ 45 rows |
| Reviews | ❌ FK constraint violation |
| Inventory | ✅ 850 rows |
| Shipping | ✅ 3,400 rows |
| Payments | ❌ Timeout after 30s |
| Coupons | ✅ 120 rows |

**Summary:** 8 of 10 tables migrated successfully. 2 tables failed.
""";

return Task.FromResult(CommandResults.Success(
"Database migrated.",
new CommandResultData
{
Value = markdown,
Format = CommandResultFormat.Markdown,
}));
});
```

### Choose a result format

`CommandResultFormat` has three values:
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/content/docs/whats-new/aspire-13-3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ await builder.build().run();

### Resource commands return structured results

Custom resource commands can now return an `ExecuteCommandResult` with a structured `Message` payload that the dashboard renders in the notification center. The new `Logger` property on `ExecuteCommandContext` lets command implementations log directly to the resource's log stream.
Custom resource commands can now return an `ExecuteCommandResult` with structured `Data` payloads (`Text`, `Json`, or `Markdown`) that the dashboard renders from the notification center's **View response** action. The `CommandResults.Success(string, CommandResultData)` overload also makes it easy to return markdown tables and other rich output from a command. The new `Logger` property on `ExecuteCommandContext` lets command implementations log directly to the resource's log stream.

<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='AppHost.cs'>
Expand Down