Skip to content
Merged
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
6 changes: 5 additions & 1 deletion docs/.vitepress/rfd-summaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"summary": "Adds group `overrides` section to enforce tool configuration that outlasts tool-level settings but yields to CLI flags."
},
"058-typed-content-blocks-for-tool-responses.md": {
"hash": "4c8b925d579414f5ffa5d8f45d6a3a9628651d690cc01e017c3e129f369398cc",
"hash": "5e603eb54c4ddd915729fc1e2e99a3b5e9bd955e0babe11883656198a5bcf2e2",
"summary": "Replace opaque tool output strings with typed content blocks (text, resource, question) mirroring MCP's CallToolResult model."
},
"059-shell-completions-and-man-pages.md": {
Expand Down Expand Up @@ -370,5 +370,9 @@
"093-inline-first-query-composition.md": {
"hash": "a4fa8987e41f656a337952452629eafd5768c9c24ffdbe30556692f0ffb616cb",
"summary": "Bare `jp query` composes inline by default; `Ctrl+X` escapes to external editor, with fallback modes configurable via `query.compose_in_editor`."
},
"094-built-in-tell_user-tool-for-mid-turn-user-addressed-messages.md": {
"hash": "ffca3c7ad1fdbeb597df5b4ac2e3ad2dd85f944b390194ade88040755af1d2da",
"summary": "Add a built-in tell_user tool letting assistants deliver mid-turn user messages without ending the agentic loop."
}
}
54 changes: 52 additions & 2 deletions docs/rfd/058-typed-content-blocks-for-tool-responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- **Date**: 2026-03-15
- **Requires**: [RFD 009], [RFD 065]
- **Required by**: [RFD 066], [RFD 067]
- **Extended by**: [RFD 094]

## Summary

Expand Down Expand Up @@ -139,6 +140,42 @@ The tool owns the formatting.
}
```

Text blocks may carry an optional `mimeType` describing the format of the text:

```json
{
"type": "text",
"text": "## Summary\n\nAll checks passed.",
"mimeType": "text/markdown"
}
```

This is a JP extension — MCP's `TextContent` has no mimeType — following the
MCP-compatible superset principle from [RFD 065].
MCP tools never set it, and absence means plain text.
LLM delivery is unchanged either way: the text passes through as-is.
The field exists to inform JP-side presentation of the block; as with
annotations, JP defines it for type-level use but does not act on it initially.

Text blocks also support MCP's standard annotations (`audience`, `priority`,
`lastModified`), matching MCP's `TextContent` schema — MCP defines annotations
on every content type, not only resources:

```json
{
"type": "text",
"text": "Summary for the user.",
"annotations": {
"audience": [
"user"
]
}
}
```

As with resource blocks, JP defines the annotation types for type-level
compatibility but does not act on them initially.

#### `resource`

Identified content with a URI and mimeType.
Expand Down Expand Up @@ -494,6 +531,13 @@ JP's internal type for tool results, defined in `jp_tool`:
pub enum ContentBlock {
Text {
text: String,
/// Optional MIME type describing the text format (JP extension; MCP
/// tools never set it).
/// Absent means plain text.
mime_type: Option<String>,
/// MCP-standard annotations (`audience`, `priority`, `lastModified`).
/// Carried for MCP compatibility; not acted on initially.
annotations: Option<Annotations>,
},
Resource(Resource),
Question {
Expand All @@ -505,8 +549,9 @@ pub enum ContentBlock {
pub struct InputRequest {
/// Unique ID for correlating answers on re-execution.
pub id: String,
/// Short prompt label (one-liner). Displayed alongside the input field
/// in the terminal, or as the question text sent to the assistant.
/// Short prompt label (one-liner).
/// Displayed alongside the input field in the terminal, or as the question
/// text sent to the assistant.
/// Supporting context belongs in content blocks, not here.
pub text: String,
/// JSON Schema defining the expected answer shape.
Expand Down Expand Up @@ -545,6 +590,10 @@ converts it to a single `ContentBlock::Text` block.
On serialization, the new format is written.
Old conversations remain readable; re-saved conversations use the new format.

The migration carries JP's own consumers of the serialized shape with it: the
terminal result renderer and the serve-web plugin become block-aware, and
`inline_results` applies uniformly to a response's blocks.

### Response parsing

`parse_command_output` in `jp_llm/src/tool.rs` is the single parsing point for
Expand Down Expand Up @@ -830,3 +879,4 @@ Depends on Phase 5.
[RFD 065]: 065-typed-resource-model-for-attachments.md
[RFD 066]: 066-content-addressable-blob-store.md
[RFD 067]: 067-resource-deduplication-for-token-efficiency.md
[RFD 094]: 094-built-in-tell_user-tool-for-mid-turn-user-addressed-messages.md
Loading
Loading