get_related_models
Retrieve related mental models with relationship details from the HUMMBL Base120 framework to enhance problem-solving and decision-making connections.
Instructions
Get all models related to a specific model with relationship details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Model code (e.g., P1, DE7) |
Implementation Reference
- src/tools/models.ts:727-771 (handler)Handler function that fetches relationships for a given model code from the HUMMBL API (/v1/models/{code}/relationships) and returns the JSON response.try { const response = await fetch( `${API_CONFIG.baseUrl}/v1/models/${code.toUpperCase()}/relationships`, { headers: { Authorization: `Bearer ${API_CONFIG.apiKey}`, }, } ); if (!response.ok) { return { content: [ { type: "text", text: `API request failed: ${response.status} ${response.statusText}`, }, ], isError: true, }; } const payload = (await response.json()) as Record<string, unknown>; return { content: [ { type: "text", text: JSON.stringify(payload, null, 2), }, ], structuredContent: payload, }; } catch (error) { return { content: [ { type: "text", text: `Failed to get related models: ${error instanceof Error ? error.message : "Unknown error"}`, }, ], isError: true, }; } }
- src/tools/models.ts:719-725 (schema)Tool metadata, description, and input schema (model code string). No output schema defined.{ title: "Get Related Mental Models", description: "Get all models related to a specific model with relationship details", inputSchema: z.object({ code: z.string().describe("Model code (e.g., P1, DE7)"), }), },
- src/tools/models.ts:718-772 (registration)Registration of the 'get_related_models' tool via server.registerTool, including inline handler and schema."get_related_models", { title: "Get Related Mental Models", description: "Get all models related to a specific model with relationship details", inputSchema: z.object({ code: z.string().describe("Model code (e.g., P1, DE7)"), }), }, async ({ code }) => { try { const response = await fetch( `${API_CONFIG.baseUrl}/v1/models/${code.toUpperCase()}/relationships`, { headers: { Authorization: `Bearer ${API_CONFIG.apiKey}`, }, } ); if (!response.ok) { return { content: [ { type: "text", text: `API request failed: ${response.status} ${response.statusText}`, }, ], isError: true, }; } const payload = (await response.json()) as Record<string, unknown>; return { content: [ { type: "text", text: JSON.stringify(payload, null, 2), }, ], structuredContent: payload, }; } catch (error) { return { content: [ { type: "text", text: `Failed to get related models: ${error instanceof Error ? error.message : "Unknown error"}`, }, ], isError: true, }; } } );