fix(repl): offer prompts in .list tab completion and rename its listing helpers
MCP prompts are live, server-owned catalog entries, not managed assets; list_prompt_assets/prompt_asset_rows implied otherwise and are now list_mcp_prompts/mcp_prompt_rows. The .list completer was also missing the prompts kind that the usage string and unknown-kind error advertise.
This commit is contained in:
@@ -164,7 +164,7 @@ pub(crate) fn asset_table(header: &[&str]) -> Table {
|
|||||||
table
|
table
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prompt_asset_rows(items: &[CatalogItem]) -> Vec<[String; 4]> {
|
fn mcp_prompt_rows(items: &[CatalogItem]) -> Vec<[String; 4]> {
|
||||||
items
|
items
|
||||||
.iter()
|
.iter()
|
||||||
.map(|item| {
|
.map(|item| {
|
||||||
@@ -3386,6 +3386,7 @@ impl RequestContext {
|
|||||||
"rags",
|
"rags",
|
||||||
"macros",
|
"macros",
|
||||||
"skills",
|
"skills",
|
||||||
|
"prompts",
|
||||||
"tools",
|
"tools",
|
||||||
"mcp-servers",
|
"mcp-servers",
|
||||||
"bundles",
|
"bundles",
|
||||||
@@ -3727,7 +3728,7 @@ impl RequestContext {
|
|||||||
.prompt_completion(&enabled_ids, args)
|
.prompt_completion(&enabled_ids, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn list_prompt_assets(&self) -> Result<()> {
|
pub async fn list_mcp_prompts(&self) -> Result<()> {
|
||||||
let items = self.tool_scope.mcp_runtime.prompt_catalog().await;
|
let items = self.tool_scope.mcp_runtime.prompt_catalog().await;
|
||||||
if items.is_empty() {
|
if items.is_empty() {
|
||||||
println!("No prompts found.");
|
println!("No prompts found.");
|
||||||
@@ -3735,7 +3736,7 @@ impl RequestContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut table = asset_table(&["server", "name", "description", "args"]);
|
let mut table = asset_table(&["server", "name", "description", "args"]);
|
||||||
for row in prompt_asset_rows(&items) {
|
for row in mcp_prompt_rows(&items) {
|
||||||
table.add_row(row.to_vec());
|
table.add_row(row.to_vec());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4867,7 +4868,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn prompt_asset_rows_assembles_columns() {
|
fn mcp_prompt_rows_assembles_columns() {
|
||||||
let items = vec![
|
let items = vec![
|
||||||
CatalogItem {
|
CatalogItem {
|
||||||
name: "summarize".to_string(),
|
name: "summarize".to_string(),
|
||||||
@@ -4886,7 +4887,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let rows = prompt_asset_rows(&items);
|
let rows = mcp_prompt_rows(&items);
|
||||||
|
|
||||||
assert_eq!(rows.len(), 2);
|
assert_eq!(rows.len(), 2);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
+1
-1
@@ -1251,7 +1251,7 @@ pub async fn run_repl_command(
|
|||||||
},
|
},
|
||||||
".list" => match args.map(str::trim) {
|
".list" => match args.map(str::trim) {
|
||||||
Some("prompts") => {
|
Some("prompts") => {
|
||||||
ctx.list_prompt_assets().await?;
|
ctx.list_mcp_prompts().await?;
|
||||||
}
|
}
|
||||||
Some(args) => {
|
Some(args) => {
|
||||||
ctx.list_assets(args)?;
|
ctx.list_assets(args)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user