Skip to main content
Glama

update_comment

Idempotent

Update a comment by its ID, optionally modifying its content.

Instructions

Update a comment.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the comment to update
contentNoA string representing the content of a comment.

Implementation Reference

  • The handler function for the update_comment tool. It destructures `id` from the input, sends a PATCH request to `/comments/{id}` via apiPatch, logs the response, and returns a formatted success/error result using formatUpdate/formatError.
    async ({ id, ...body }) => {
      try {
        const record = await apiPatch<EduframeRecord>(`/comments/${id}`, body);
        void logResponse("update_comment", { id, ...body }, record);
        return formatUpdate(record, "comment");
      } catch (error) {
        return formatError(error);
      }
    },
  • The schema/metadata for the update_comment tool. Defines the input schema requiring `id` (positive integer) and optional `content` (string).
    {
      description: "Update a comment.",
      annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
      inputSchema: {
        id: z.number().int().positive().describe("ID of the comment to update"),
        content: z.string().optional().describe("A string representing the content of a comment."),
      },
    },
  • Registration of the update_comment tool via server.registerTool within the registerCommentTools function.
    server.registerTool(
      "update_comment",
      {
        description: "Update a comment.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the comment to update"),
          content: z.string().optional().describe("A string representing the content of a comment."),
        },
      },
      async ({ id, ...body }) => {
        try {
          const record = await apiPatch<EduframeRecord>(`/comments/${id}`, body);
          void logResponse("update_comment", { id, ...body }, record);
          return formatUpdate(record, "comment");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The apiPatch helper function used by the update_comment handler to make a PATCH request to the Eduframe API.
    export async function apiPatch<T>(path: string, body: unknown): Promise<T> {
      const { token } = getConfig();
      const url = buildUrl(path);
    
      const response = await fetch(url.toString(), {
        method: "PATCH",
        headers: buildHeaders(token),
        body: JSON.stringify(body),
      });
    
      return handleResponse<T>(response);
    }
  • The formatUpdate helper used to format the response after successfully updating a comment.
    export function formatUpdate(record: EduframeRecord, resourceName: string): CallToolResult {
      return {
        content: [
          {
            type: "text",
            text: `Successfully updated ${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`,
          },
        ],
      };
    }
Behavior2/5

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

The description adds no behavioral context beyond what annotations already provide (readOnlyHint=false, destructiveHint=false, idempotentHint=true). It does not disclose side effects, permissions, or return behavior.

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

Conciseness2/5

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

The description is extremely short (3 words) but fails to add value—it essentially restates the tool name. This is under-specification rather than effective conciseness.

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

Completeness2/5

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

For a simple update tool with 2 parameters and no output schema, the description is too minimal. It does not explain what can be updated (content implied by schema), any side effects, or the result of the operation.

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

Parameters3/5

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

Schema coverage is 100% with both parameters having descriptions, so a baseline of 3 is appropriate. The tool description does not add any additional meaning or constraints beyond the schema.

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

Purpose4/5

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

The description 'Update a comment.' clearly indicates the action (update) and the resource (comment), which distinguishes it from other tools like create_comment and delete_comment. However, it is essentially a paraphrase of the tool name and lacks additional context to differentiate it from other update tools.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as create_comment or delete_comment. There are no explicit contexts, prerequisites, or exclusions mentioned.

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/martijnpieters/eduframe-mcp'

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