edit-thread-metadata
Modify or remove metadata for threads in Liveblocks collaborative applications to organize and manage conversation data.
Instructions
Edit a Liveblocks thread's metadata. null can be used to remove a key.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| roomId | Yes | ||
| threadId | Yes | ||
| data | Yes |
Implementation Reference
- src/server.ts:313-336 (registration)Registration of the 'edit-thread-metadata' MCP tool, including inline input schema (Zod) and handler function that proxies to Liveblocks API via callLiveblocksApi.server.tool( "edit-thread-metadata", `Edit a Liveblocks thread's metadata. \`null\` can be used to remove a key.`, { roomId: z.string(), threadId: z.string(), data: z.object({ metadata: z.record( z.string(), z.union([z.string(), z.boolean(), z.number(), z.null()]) ), userId: z.string(), updatedAt: z.date().optional(), }), }, async ({ roomId, threadId, data }, extra) => { return await callLiveblocksApi( getLiveblocks().editThreadMetadata( { roomId, threadId, data }, { signal: extra.signal } ) ); } );
- src/server.ts:328-335 (handler)The handler function executes the tool logic by calling the Liveblocks editThreadMetadata API and formatting the response.async ({ roomId, threadId, data }, extra) => { return await callLiveblocksApi( getLiveblocks().editThreadMetadata( { roomId, threadId, data }, { signal: extra.signal } ) ); }
- src/server.ts:317-327 (schema)Inline Zod schema defining the input parameters for the edit-thread-metadata tool.roomId: z.string(), threadId: z.string(), data: z.object({ metadata: z.record( z.string(), z.union([z.string(), z.boolean(), z.number(), z.null()]) ), userId: z.string(), updatedAt: z.date().optional(), }), },
- src/utils.ts:3-37 (helper)Shared helper function used by the handler to execute Liveblocks API calls and format MCP tool responses.export async function callLiveblocksApi( liveblocksPromise: Promise<any> ): Promise<CallToolResult> { try { const data = await liveblocksPromise; if (!data) { return { content: [{ type: "text", text: "Success. No data returned." }], }; } return { content: [ { type: "text", text: "Here is the data. If the user has no specific questions, return it in a JSON code block", }, { type: "text", text: JSON.stringify(data, null, 2), }, ], }; } catch (err) { return { content: [ { type: "text", text: "" + err, }, ], }; } }