summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaolo Ricciuti <[email protected]>2025-12-31 16:34:36 +0100
committerGitHub <[email protected]>2025-12-31 09:34:36 -0600
commit5249f04ea067600df73b13589b815a844f7029a6 (patch)
tree04412c9079796e5499b65c9cf8b250d6f01ffe11
parent6e3ead198e36b451a705eea74856ee6077f121db (diff)
downloadopencode-5249f04ea067600df73b13589b815a844f7029a6.tar.gz
opencode-5249f04ea067600df73b13589b815a844f7029a6.zip
fix: display MCP tag for prompts in autocomplete but not in prompt (#6531)
-rw-r--r--packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx2
-rw-r--r--packages/opencode/src/command/index.ts2
-rw-r--r--packages/opencode/src/mcp/index.ts2
-rw-r--r--packages/sdk/js/src/v2/gen/types.gen.ts1
-rw-r--r--packages/sdk/openapi.json3
5 files changed, 8 insertions, 2 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
index a58232895..2e68fdcd9 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx
@@ -259,7 +259,7 @@ export function Autocomplete(props: {
const s = session()
for (const command of sync.data.command) {
results.push({
- display: "/" + command.name,
+ display: "/" + command.name + (command.mcp ? " (MCP)" : ""),
description: command.description,
onSelect: () => {
const newText = "/" + command.name + " "
diff --git a/packages/opencode/src/command/index.ts b/packages/opencode/src/command/index.ts
index 329e6b3e5..c97bcfadd 100644
--- a/packages/opencode/src/command/index.ts
+++ b/packages/opencode/src/command/index.ts
@@ -27,6 +27,7 @@ export namespace Command {
description: z.string().optional(),
agent: z.string().optional(),
model: z.string().optional(),
+ mcp: z.boolean().optional(),
// workaround for zod not supporting async functions natively so we use getters
// https://zod.dev/v4/changelog?id=zfunction
template: z.promise(z.string()).or(z.string()),
@@ -94,6 +95,7 @@ export namespace Command {
for (const [name, prompt] of Object.entries(await MCP.prompts())) {
result[name] = {
name,
+ mcp: true,
description: prompt.description,
get template() {
// since a getter can't be async we need to manually return a promise here
diff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.ts
index b33ab68a8..10a063667 100644
--- a/packages/opencode/src/mcp/index.ts
+++ b/packages/opencode/src/mcp/index.ts
@@ -195,7 +195,7 @@ export namespace MCP {
for (const prompt of prompts.prompts) {
const sanitizedClientName = clientName.replace(/[^a-zA-Z0-9_-]/g, "_")
const sanitizedPromptName = prompt.name.replace(/[^a-zA-Z0-9_-]/g, "_")
- const key = sanitizedClientName + ":" + sanitizedPromptName + " (MCP)"
+ const key = sanitizedClientName + ":" + sanitizedPromptName
commands[key] = { ...prompt, client: clientName }
}
diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts
index 8b3bece00..85a3c4286 100644
--- a/packages/sdk/js/src/v2/gen/types.gen.ts
+++ b/packages/sdk/js/src/v2/gen/types.gen.ts
@@ -1733,6 +1733,7 @@ export type Command = {
description?: string
agent?: string
model?: string
+ mcp?: boolean
template: string
subtask?: boolean
hints: Array<string>
diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json
index 4924a5bfa..973c217fd 100644
--- a/packages/sdk/openapi.json
+++ b/packages/sdk/openapi.json
@@ -8982,6 +8982,9 @@
"model": {
"type": "string"
},
+ "mcp": {
+ "type": "boolean"
+ },
"template": {
"anyOf": [
{