cache_edit_and_approve_proposal
Edit an existing pending proposal and approve it in one step. Provide the edit field matching the proposal type: new_threshold for threshold_adjust, new_ttl_seconds for tool_ttl_adjust.
Instructions
Edit an existing pending proposal and approve it in one step. Provide exactly one edit field matching the proposal type: new_threshold for threshold_adjust, new_ttl_seconds for tool_ttl_adjust. Invalidate proposals are not editable.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| proposal_id | Yes | Proposal id | |
| new_threshold | No | For threshold_adjust proposals | |
| new_ttl_seconds | No | For tool_ttl_adjust proposals | |
| actor | No | Optional actor identity stamped into the audit trail |
Implementation Reference
- packages/mcp/src/index.ts:1142-1191 (handler)The 'cache_edit_and_approve_proposal' tool registration and handler. It defines the MCP tool with schema params (proposal_id, new_threshold, new_ttl_seconds, actor), validates that exactly one edit field is provided, and calls POST /mcp/cache-proposals/:proposalId/edit-and-approve on the API.
server.tool( 'cache_edit_and_approve_proposal', 'Edit an existing pending proposal and approve it in one step. Provide exactly one edit field matching the proposal type: new_threshold for threshold_adjust, new_ttl_seconds for tool_ttl_adjust. Invalidate proposals are not editable.', { proposal_id: z.string().min(1).describe('Proposal id'), new_threshold: z.number().min(0).max(2).optional().describe('For threshold_adjust proposals'), new_ttl_seconds: z.number().int().min(10).max(86400).optional().describe('For tool_ttl_adjust proposals'), actor: z.string().min(1).optional().describe('Optional actor identity stamped into the audit trail'), }, async (params) => withTelemetry('cache_edit_and_approve_proposal', async () => { try { if (params.new_threshold === undefined && params.new_ttl_seconds === undefined) { return { content: [{ type: 'text' as const, text: 'Either new_threshold or new_ttl_seconds is required' }], isError: true, }; } if (params.new_threshold !== undefined && params.new_ttl_seconds !== undefined) { return { content: [{ type: 'text' as const, text: 'new_threshold and new_ttl_seconds are mutually exclusive — provide exactly one' }], isError: true, }; } const body: Record<string, unknown> = {}; if (params.new_threshold !== undefined) { body.new_threshold = params.new_threshold; } if (params.new_ttl_seconds !== undefined) { body.new_ttl_seconds = params.new_ttl_seconds; } if (params.actor !== undefined) { body.actor = params.actor; } const data = await apiRequest( 'POST', `/mcp/cache-proposals/${encodeURIComponent(params.proposal_id)}/edit-and-approve`, body, ); if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }), ); - packages/mcp/src/index.ts:1142-1191 (registration)Tool registered using server.tool() with description and Zod schema for cache_edit_and_approve_proposal.
server.tool( 'cache_edit_and_approve_proposal', 'Edit an existing pending proposal and approve it in one step. Provide exactly one edit field matching the proposal type: new_threshold for threshold_adjust, new_ttl_seconds for tool_ttl_adjust. Invalidate proposals are not editable.', { proposal_id: z.string().min(1).describe('Proposal id'), new_threshold: z.number().min(0).max(2).optional().describe('For threshold_adjust proposals'), new_ttl_seconds: z.number().int().min(10).max(86400).optional().describe('For tool_ttl_adjust proposals'), actor: z.string().min(1).optional().describe('Optional actor identity stamped into the audit trail'), }, async (params) => withTelemetry('cache_edit_and_approve_proposal', async () => { try { if (params.new_threshold === undefined && params.new_ttl_seconds === undefined) { return { content: [{ type: 'text' as const, text: 'Either new_threshold or new_ttl_seconds is required' }], isError: true, }; } if (params.new_threshold !== undefined && params.new_ttl_seconds !== undefined) { return { content: [{ type: 'text' as const, text: 'new_threshold and new_ttl_seconds are mutually exclusive — provide exactly one' }], isError: true, }; } const body: Record<string, unknown> = {}; if (params.new_threshold !== undefined) { body.new_threshold = params.new_threshold; } if (params.new_ttl_seconds !== undefined) { body.new_ttl_seconds = params.new_ttl_seconds; } if (params.actor !== undefined) { body.actor = params.actor; } const data = await apiRequest( 'POST', `/mcp/cache-proposals/${encodeURIComponent(params.proposal_id)}/edit-and-approve`, body, ); if (isLicenseError(data)) { return { content: [{ type: 'text' as const, text: licenseErrorResult(data) }] }; } return { content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }] }; } catch (err) { return { content: [{ type: 'text' as const, text: err instanceof Error ? err.message : String(err) }], isError: true, }; } }), ); - packages/mcp/src/index.ts:1145-1150 (schema)Zod schema for the tool inputs: proposal_id (string), new_threshold (number 0-2, optional), new_ttl_seconds (int 10-86400, optional), actor (string, optional).
{ proposal_id: z.string().min(1).describe('Proposal id'), new_threshold: z.number().min(0).max(2).optional().describe('For threshold_adjust proposals'), new_ttl_seconds: z.number().int().min(10).max(86400).optional().describe('For tool_ttl_adjust proposals'), actor: z.string().min(1).optional().describe('Optional actor identity stamped into the audit trail'), },