Skip to main content
Glama

update_affiliation

Idempotent

Update an existing affiliation by providing its ID and optional fields such as key contact status, user, or account.

Instructions

Update an affiliation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the affiliation to update
key_contactNoBoolean indicating if this user is a key contact of the account.
user_idNoUnique identifier of the associated user
account_idNoUnique identifier of the associated account

Implementation Reference

  • The "update_affiliation" tool handler. It is registered via server.registerTool, takes id (path param) and optional key_contact, user_id, account_id (body), calls apiPatch to PATCH /affiliations/{id}, logs the response, and formats the result using formatUpdate.
    server.registerTool(
      "update_affiliation",
      {
        description: "Update an affiliation.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the affiliation to update"),
          key_contact: z
            .boolean()
            .optional()
            .describe("Boolean indicating if this user is a key contact of the account."),
          user_id: z.number().int().optional().describe("Unique identifier of the associated user"),
          account_id: z.number().int().optional().describe("Unique identifier of the associated account"),
        },
      },
      async ({ id, ...body }) => {
        try {
          const record = await apiPatch<EduframeRecord>(`/affiliations/${id}`, body);
          void logResponse("update_affiliation", { id, ...body }, record);
          return formatUpdate(record, "affiliation");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The tool is registered inside the `registerAffiliationTools` function on line 7, via `server.registerTool("update_affiliation", ...)`. Registration includes the input schema with id, key_contact, user_id, account_id fields.
    server.registerTool(
      "update_affiliation",
      {
        description: "Update an affiliation.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the affiliation to update"),
          key_contact: z
            .boolean()
            .optional()
            .describe("Boolean indicating if this user is a key contact of the account."),
          user_id: z.number().int().optional().describe("Unique identifier of the associated user"),
          account_id: z.number().int().optional().describe("Unique identifier of the associated account"),
        },
      },
      async ({ id, ...body }) => {
        try {
          const record = await apiPatch<EduframeRecord>(`/affiliations/${id}`, body);
          void logResponse("update_affiliation", { id, ...body }, record);
          return formatUpdate(record, "affiliation");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Input schema defined inline in the second argument of registerTool. Uses Zod: id (z.number().int().positive()), key_contact (z.boolean().optional()), user_id (z.number().int().optional()), account_id (z.number().int().optional()).
    server.registerTool(
      "update_affiliation",
      {
        description: "Update an affiliation.",
        annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          id: z.number().int().positive().describe("ID of the affiliation to update"),
          key_contact: z
            .boolean()
            .optional()
            .describe("Boolean indicating if this user is a key contact of the account."),
          user_id: z.number().int().optional().describe("Unique identifier of the associated user"),
          account_id: z.number().int().optional().describe("Unique identifier of the associated account"),
        },
      },
      async ({ id, ...body }) => {
        try {
          const record = await apiPatch<EduframeRecord>(`/affiliations/${id}`, body);
          void logResponse("update_affiliation", { id, ...body }, record);
          return formatUpdate(record, "affiliation");
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • The apiPatch function used by the handler to perform a PATCH request to /affiliations/{id}. It sends the token-authenticated request with a JSON body.
     * Perform a PATCH request to partially update a resource.
     *
     * @param path - API path, e.g. "/leads/1"
     * @param body - Request body
     */
    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 function that formats the PATCH response into a human-readable CallToolResult with 'Successfully updated affiliation:' prefix.
    /**
     * Format the response of an UPDATE tool call.
     *
     * @param record - The updated resource record returned by the API.
     * @param resourceName - Human-readable name of the resource type (e.g. "course").
     */
    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 the annotations. Annotations indicate the tool is mutating (readOnlyHint=false) and idempotent, but the description does not mention any side effects, permissions, or other behavioral traits.

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 concise (3 words) but severely under-specified. It does not provide enough information to be useful, trading conciseness for completeness.

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?

Given the tool has 4 parameters, no output schema, and many siblings, the description is inadequate. It does not explain what updating an affiliation entails, return values, or prerequisites.

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?

The input schema provides descriptions for all 4 parameters (100% coverage), so the baseline is 3. The description adds no additional meaning beyond the schema.

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

Purpose3/5

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

The description 'Update an affiliation.' states the verb and resource clearly, but lacks differentiation from siblings like create_affiliation or update_organization_affiliation. No scope or details are provided, making it minimally clear.

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?

No guidance is given on when to use this tool versus alternatives such as create_affiliation or delete_affiliation. The description does not specify any context or exclusions.

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