Skip to content

Commit 8decc2e

Browse files
committed
feat(bin): make title, language, visibility optional in update
1 parent 5081917 commit 8decc2e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/tools/one/bin.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ export async function registerBinTools (server: McpServer) {
148148
'Update an existing Vuetify bin. Requires VUETIFY_API_KEY.',
149149
{
150150
id: z.string().describe('The bin ID to update'),
151-
title: z.string().describe('Title of your bin'),
152-
language: z.string().describe('Language of your vuetify bin'),
153151
content: z.string().describe('The content of your bin'),
154-
visibility: z.enum(['private', 'public']).describe('Visibility of bin'),
155-
favorite: z.boolean().default(false),
156-
pinned: z.boolean().default(false),
157-
locked: z.boolean().default(false),
152+
title: z.string().optional().describe('Title of your bin'),
153+
language: z.string().optional().describe('Language of your vuetify bin'),
154+
visibility: z.enum(['private', 'public']).optional().describe('Visibility of bin'),
155+
favorite: z.boolean().optional(),
156+
pinned: z.boolean().optional(),
157+
locked: z.boolean().optional(),
158158
},
159159
{
160160
openWorldHint: true,
@@ -163,11 +163,17 @@ export async function registerBinTools (server: McpServer) {
163163
try {
164164
const apiKey = getApiKey(extra)
165165
const apiServer = process.env.VUETIFY_API_SERVER || 'https://api.vuetifyjs.com'
166+
167+
// Filter out undefined values so API preserves existing
168+
const updates = Object.fromEntries(
169+
Object.entries(bin).filter(([_, v]) => v !== undefined)
170+
)
171+
166172
const binResponse = await fetch(`${apiServer}/one/bins/${id}`, {
167173
method: 'POST',
168174
body: JSON.stringify({
169175
bin: {
170-
...bin,
176+
...updates,
171177
liveShare: false,
172178
},
173179
}),

0 commit comments

Comments
 (0)