Skip to main content
Glama

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
NameRequiredDescriptionDefault
codeYesModel code (e.g., P1, DE7)

Implementation Reference

  • 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,
        };
      }
    }
  • 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)"),
      }),
    },
  • 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,
          };
        }
      }
    );

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/hummbl-dev/mcp-server'

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