The open source coding agent.
TypeScript
fix: display MCP tag for prompts in autocomplete but not in prompt (#6531)
Paolo Ricciuti5249f04ea067
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsxindex a5823289505..2e68fdcd924 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.tsindex 329e6b3e516..c97bcfadd13 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=zfunctiontemplate: 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 herediff --git a/packages/opencode/src/mcp/index.ts b/packages/opencode/src/mcp/index.tsindex b33ab68a800..10a0636675f 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 + ":" + sanitizedPromptNamecommands[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.tsindex 8b3bece004f..85a3c428625 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?: stringagent?: stringmodel?: string+ mcp?: booleantemplate: stringsubtask?: booleanhints: Array<string>diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.jsonindex 4924a5bfac0..973c217fd18 100644--- a/packages/sdk/openapi.json+++ b/packages/sdk/openapi.json@@ -8982,6 +8982,9 @@"model": {"type": "string"},+ "mcp": {+ "type": "boolean"+ },"template": {"anyOf": [{