Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
proposal_idYesProposal id
new_thresholdNoFor threshold_adjust proposals
new_ttl_secondsNoFor tool_ttl_adjust proposals
actorNoOptional actor identity stamped into the audit trail

Implementation Reference

  • 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,
          };
        }
      }),
    );
  • 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,
          };
        }
      }),
    );
  • 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'),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It states the combined edit+approve action and the non-editable invalidate proposals, but omits details on prerequisites (proposal must be pending, matching type), side effects, error states, or authorization needs. This is a significant gap for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: first states purpose, second details edit field requirements and a limitation. No redundant or unnecessary text. Information is front-loaded and efficiently structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers core functionality and parameter constraints, but lacks details on return values, error conditions, prerequisites (e.g., proposal must be pending and match the edit field), and atomicity of the combined operation. With no output schema, more context would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, but the tool description adds crucial context: exactly one edit field must be provided based on proposal type. This constraint is not obvious from individual parameter descriptions, and the description clarifies mutual exclusivity and matching logic.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's action: 'Edit an existing pending proposal and approve it in one step.' It also specifies the exact edit fields for each proposal type, distinguishing it from siblings like cache_approve_proposal which likely only approves.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides context for use (one-step edit+approve) and mentions that invalidate proposals are not editable, but lacks explicit guidance on when to use this tool versus alternatives like cache_approve_proposal or separate propose steps. No when-not or alternative references.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BetterDB-inc/monitor'

If you have feedback or need assistance with the MCP directory API, please join our Discord server