Skip to main content
Glama

get_affiliations

Read-onlyIdempotent

Fetch affiliations from Eduframe, filtered by user ID or account ID, with pagination support.

Instructions

Get all affiliations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cursorNoCursor for fetching the next page of results
per_pageNoNumber of results per page (default: 25)
user_idNoFilter results on user_id
account_idNoFilter results on account_id

Implementation Reference

  • Handler function for the get_affiliations tool. Makes a GET request to /affiliations with optional cursor, per_page, user_id, and account_id parameters, formats the list response, and appends a next-cursor hint if pagination is available.
    async ({ cursor, per_page, user_id, account_id }) => {
      try {
        const result = await apiList<EduframeRecord>("/affiliations", { cursor, per_page, user_id, account_id });
        void logResponse("get_affiliations", { cursor, per_page, user_id, account_id }, result);
        const toolResult = formatList(result.records, "affiliations");
        if (result.nextCursor) {
          toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
        }
        return toolResult;
      } catch (error) {
        return formatError(error);
      }
    },
  • Schema and metadata for the get_affiliations tool. Defines read-only, non-destructive, idempotent annotations and optional input parameters: cursor, per_page, user_id, account_id.
    {
      description: "Get all affiliations",
      annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
      inputSchema: {
        cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
        per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
        user_id: z.number().int().optional().describe("Filter results on user_id"),
        account_id: z.number().int().optional().describe("Filter results on account_id"),
      },
  • Registration of get_affiliations tool on the MCP server via server.registerTool() inside registerAffiliationTools().
    server.registerTool(
      "get_affiliations",
      {
        description: "Get all affiliations",
        annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },
        inputSchema: {
          cursor: z.string().optional().describe("Cursor for fetching the next page of results"),
          per_page: z.number().int().positive().optional().describe("Number of results per page (default: 25)"),
          user_id: z.number().int().optional().describe("Filter results on user_id"),
          account_id: z.number().int().optional().describe("Filter results on account_id"),
        },
      },
      async ({ cursor, per_page, user_id, account_id }) => {
        try {
          const result = await apiList<EduframeRecord>("/affiliations", { cursor, per_page, user_id, account_id });
          void logResponse("get_affiliations", { cursor, per_page, user_id, account_id }, result);
          const toolResult = formatList(result.records, "affiliations");
          if (result.nextCursor) {
            toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` });
          }
          return toolResult;
        } catch (error) {
          return formatError(error);
        }
      },
    );
  • Helper function used by the handler to perform a paginated GET list request against the Eduframe API. Returns typed records plus a nextCursor for cursor-based pagination.
    export async function apiList<T>(path: string, query?: Record<string, QueryValue>): Promise<ListResult<T>> {
      const { token } = getConfig();
      const url = buildUrl(path, query);
    
      const response = await fetch(url.toString(), {
        method: "GET",
        headers: buildHeaders(token),
      });
    
      await checkResponse(response);
    
      const records = (await response.json()) as T[];
      const nextCursor = parseNextCursor(response.headers.get("Link"));
    
      return { records, nextCursor };
    }
Behavior3/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, covering safety and idempotency. The description adds no behavioral context beyond the tool's purpose, which is acceptable given the strong annotations.

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

Conciseness4/5

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

The description is a single sentence, concise and to the point. It is appropriately sized for a simple retrieval tool, though it could benefit from slight elaboration on scope.

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?

For a read-only tool with full schema coverage and strong annotations, the description is minimally sufficient. However, it lacks context about the entity type (e.g., user or account affiliations) and does not explain usage relative to sibling tools.

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 four parameters (cursor, per_page, user_id, account_id), achieving 100% coverage. The description does not add meaning beyond the schema, so it meets the baseline.

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 'Get all affiliations' clearly indicates the verb (get) and resource (affiliations), but it does not distinguish this tool from the sibling 'get_organization_affiliations', which likely retrieves similar data.

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 provided on when to use this tool versus alternatives like 'get_organization_affiliations' or 'create_affiliation'. The description offers no context for selection.

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