Update Broadcast Message
update_broadcast_messageUpdate an existing GitLab broadcast message by modifying its text, schedule, colors, audience, or other properties. Requires administrator access.
Instructions
Update an existing GitLab broadcast message. Requires administrator privileges.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Broadcast message ID | |
| message | No | Message text to display | |
| starts_at | No | ISO 8601 timestamp when the message starts | |
| ends_at | No | ISO 8601 timestamp when the message ends | |
| color | No | Background color in hex format, e.g. "#E75E40" | |
| font | No | Foreground (font) color in hex format | |
| target_access_levels | No | Access levels to target: 10=Guest, 20=Reporter, 30=Developer, 40=Maintainer, 50=Owner | |
| target_path | No | Path glob for pages where the message should appear | |
| broadcast_type | No | Broadcast type: "banner" or "notification" | |
| dismissable | No | Whether users can dismiss the broadcast message | |
| theme | No | Theme name (GitLab 16.9+), e.g. "indigo", "red" | |
| userCredentials | No | Your GitLab credentials (optional — falls back to the configured env token if not provided) |
Implementation Reference
- src/tools.ts:1651-1662 (schema)Shared field definitions for broadcast messages used by create/update input schemas
const BroadcastMessageFields = { message: z.string().min(1).describe('Message text to display'), starts_at: z.string().datetime().optional().describe('ISO 8601 timestamp when the message starts'), ends_at: z.string().datetime().optional().describe('ISO 8601 timestamp when the message ends'), color: z.string().optional().describe('Background color in hex format, e.g. "#E75E40"'), font: z.string().optional().describe('Foreground (font) color in hex format'), target_access_levels: z.array(z.number().int()).optional().describe('Access levels to target: 10=Guest, 20=Reporter, 30=Developer, 40=Maintainer, 50=Owner'), target_path: z.string().optional().describe('Path glob for pages where the message should appear'), broadcast_type: z.enum(['banner', 'notification']).optional().describe('Broadcast type: "banner" or "notification"'), dismissable: z.boolean().optional().describe('Whether users can dismiss the broadcast message'), theme: z.string().optional().describe('Theme name (GitLab 16.9+), e.g. "indigo", "red"'), }; - src/tools.ts:1715-1743 (handler)Tool definition for update_broadcast_message: handler extracts the id and body from input, validates auth, and delegates to client.updateBroadcastMessage
const updateBroadcastMessageTool: Tool = { name: 'update_broadcast_message', title: 'Update Broadcast Message', description: 'Update an existing GitLab broadcast message. Requires administrator privileges.', requiresAuth: true, requiresWrite: true, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: withUserAuth(z.object({ id: z.number().int().describe('Broadcast message ID'), message: BroadcastMessageFields.message.optional(), starts_at: BroadcastMessageFields.starts_at, ends_at: BroadcastMessageFields.ends_at, color: BroadcastMessageFields.color, font: BroadcastMessageFields.font, target_access_levels: BroadcastMessageFields.target_access_levels, target_path: BroadcastMessageFields.target_path, broadcast_type: BroadcastMessageFields.broadcast_type, dismissable: BroadcastMessageFields.dismissable, theme: BroadcastMessageFields.theme, })), handler: async (input, client, userConfig) => { const credentials = input.userCredentials ? validateUserConfig(input.userCredentials) : userConfig; if (!credentials) { throw new Error('User authentication is required for updating broadcast messages.'); } const { id, userCredentials, ...body } = input; return client.updateBroadcastMessage(id, body, credentials); }, }; - src/tools.ts:2307-2317 (registration)updateBroadcastMessageTool is registered in writeTools[] array
export const writeTools: Tool[] = [ createIssueTool, createMergeRequestTool, createNoteTool, deleteNoteTool, updateNoteTool, managePipelineTool, createBroadcastMessageTool, updateBroadcastMessageTool, deleteBroadcastMessageTool, ]; - src/gitlab-client.ts:2684-2697 (handler)Client method that executes the actual REST API PUT request to /broadcast_messages/{id} to update the broadcast message
async updateBroadcastMessage(id: number, input: { message?: string; starts_at?: string; ends_at?: string; color?: string; font?: string; target_access_levels?: number[]; target_path?: string; broadcast_type?: 'banner' | 'notification'; dismissable?: boolean; theme?: string; }, userConfig?: UserConfig): Promise<any> { return this.restRequest('PUT', `/broadcast_messages/${id}`, { body: input, userConfig, requiresWrite: true }); }