Skip to content

Commit d43b2a2

Browse files
fix: display MCP tag for prompts in autocomplete but not in prompt (anomalyco#6531)
1 parent a8e2f99 commit d43b2a2

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

packages/opencode/src/cli/cmd/tui/component/prompt/autocomplete.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export function Autocomplete(props: {
259259
const s = session()
260260
for (const command of sync.data.command) {
261261
results.push({
262-
display: "/" + command.name,
262+
display: "/" + command.name + (command.mcp ? " (MCP)" : ""),
263263
description: command.description,
264264
onSelect: () => {
265265
const newText = "/" + command.name + " "

packages/opencode/src/command/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export namespace Command {
2727
description: z.string().optional(),
2828
agent: z.string().optional(),
2929
model: z.string().optional(),
30+
mcp: z.boolean().optional(),
3031
// workaround for zod not supporting async functions natively so we use getters
3132
// https://zod.dev/v4/changelog?id=zfunction
3233
template: z.promise(z.string()).or(z.string()),
@@ -94,6 +95,7 @@ export namespace Command {
9495
for (const [name, prompt] of Object.entries(await MCP.prompts())) {
9596
result[name] = {
9697
name,
98+
mcp: true,
9799
description: prompt.description,
98100
get template() {
99101
// since a getter can't be async we need to manually return a promise here

packages/opencode/src/mcp/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export namespace MCP {
195195
for (const prompt of prompts.prompts) {
196196
const sanitizedClientName = clientName.replace(/[^a-zA-Z0-9_-]/g, "_")
197197
const sanitizedPromptName = prompt.name.replace(/[^a-zA-Z0-9_-]/g, "_")
198-
const key = sanitizedClientName + ":" + sanitizedPromptName + " (MCP)"
198+
const key = sanitizedClientName + ":" + sanitizedPromptName
199199

200200
commands[key] = { ...prompt, client: clientName }
201201
}

packages/sdk/js/src/v2/gen/types.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ export type Command = {
17331733
description?: string
17341734
agent?: string
17351735
model?: string
1736+
mcp?: boolean
17361737
template: string
17371738
subtask?: boolean
17381739
hints: Array<string>

packages/sdk/openapi.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8982,6 +8982,9 @@
89828982
"model": {
89838983
"type": "string"
89848984
},
8985+
"mcp": {
8986+
"type": "boolean"
8987+
},
89858988
"template": {
89868989
"anyOf": [
89878990
{

0 commit comments

Comments
 (0)