get_associations_of_object
Retrieve all associations linked to a system object by providing its object type ID. Optionally paginate results with cursor and per_page parameters.
Instructions
Get all associations of a system object
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_type | Yes | ID of the parent resource | |
| cursor | No | Cursor for fetching the next page of results | |
| per_page | No | Number of results per page (default: 25) |
Implementation Reference
- src/tools/custom_associations.ts:19-31 (handler)Handler function that executes the tool logic: calls the Eduframe API endpoint /custom/{object_type}/associations, logs the response, formats the list result, and appends pagination cursor if available.
async ({ object_type, cursor, per_page }) => { try { const result = await apiList<EduframeRecord>(`/custom/${object_type}/associations`, { cursor, per_page }); void logResponse("get_associations_of_object", { object_type, cursor, per_page }, result); const toolResult = formatList(result.records, "custom associations"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, - Input schema with Zod validation accepting object_type (required positive int), cursor (optional string), and per_page (optional positive int).
{ description: "Get all associations of a system object", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { object_type: z.number().int().positive().describe("ID of the parent resource"), 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)"), }, - src/tools/custom_associations.ts:8-33 (registration)Registration of the tool via server.registerTool with the name 'get_associations_of_object', its schema, and handler.
server.registerTool( "get_associations_of_object", { description: "Get all associations of a system object", annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }, inputSchema: { object_type: z.number().int().positive().describe("ID of the parent resource"), 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)"), }, }, async ({ object_type, cursor, per_page }) => { try { const result = await apiList<EduframeRecord>(`/custom/${object_type}/associations`, { cursor, per_page }); void logResponse("get_associations_of_object", { object_type, cursor, per_page }, result); const toolResult = formatList(result.records, "custom associations"); if (result.nextCursor) { toolResult.content.push({ type: "text", text: `\nNext page cursor: ${result.nextCursor}` }); } return toolResult; } catch (error) { return formatError(error); } }, ); } - src/tools/index.ts:64-132 (registration)The registration aggregator that collects registerCustomAssociationTools (along with all other tool registrations) and calls each one in registerAllTools.
const tools: Array<(server: McpServer) => void> = [ registerAccountTools, registerAffiliationTools, registerAttendanceTools, registerAuthenticationTools, registerCatalogProductTools, registerCatalogVariantTools, registerCategorieTools, registerCertificateTools, registerCommentTools, registerCourseLocationTools, registerCourseTabTools, registerCourseVariantTools, registerCourseTools, registerCreditCategorieTools, registerCreditTools, registerCustomAssociationTools, registerCustomFieldOptionTools, registerCustomObjectTools, registerCustomRecordTools, registerDiscountCodeTools, registerEditionDescriptionSectionTools, registerEducatorTools, registerEmailTools, registerEnrollmentTools, registerGradeTools, registerInvoiceVatTools, registerInvoiceTools, registerLabelTools, registerLeadTools, registerMaterialGroupTools, registerMaterialTools, registerMeetingLocationTools, registerMeetingTools, registerOrderTools, registerOrganizationTools, registerPaymentMethodTools, registerPaymentOptionTools, registerPaymentTools, registerPlannedCourseTools, registerPlanningAttendeeTools, registerPlanningConflictTools, registerPlanningEventTools, registerPlanningLocationTools, registerPlanningMaterialTools, registerPlanningRequiredTeacherGroupAttendeeTools, registerPlanningTeacherTools, registerProgramEditionTools, registerProgramElementTools, registerProgramEnrollmentTools, registerProgramPersonalProgramElementTools, registerProgramProgramTools, registerReferralTools, registerSignupQuestionTools, registerTaskTools, registerTeacherEnrollmentTools, registerTeacherRoleTools, registerTeacherTools, registerTheseTools, registerUserTools, registerWebhookNotificationTools, registerWebhookTools, ]; export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/api.ts:122-137 (helper)The apiList helper function used by the handler to make the paginated GET request to the Eduframe API and return typed records with nextCursor.
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 }; }