Skip to main content
Glama

search_models

Search mental models by keyword to find relevant frameworks for problem-solving and decision-making across codes, names, and definitions.

Instructions

Search HUMMBL mental models by keyword across codes, names, and definitions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query (minimum 2 characters)

Implementation Reference

  • MCP tool registration for 'search_models', including input/output schemas (using Zod) and the complete handler function that performs the search, enriches results with transformation data, and returns structured JSON response.
    server.registerTool( "search_models", { title: "Search Mental Models", description: "Search HUMMBL mental models by keyword across codes, names, and definitions.", inputSchema: z.object({ query: z.string().min(2).describe("Search query (minimum 2 characters)"), }), outputSchema: z.object({ query: z.string(), resultCount: z.number(), results: z.array( z.object({ code: z.string(), name: z.string(), definition: z.string(), priority: z.number(), transformation: z.string(), }) ), }), }, async ({ query }) => { const result = searchModels(query); if (!isOk(result)) { return { content: [ { type: "text", text: `Unable to search models: ${result.error.type}`, }, ], isError: true, } as const; } const enriched = result.value.map((m) => { const trans = Object.values(TRANSFORMATIONS).find((t) => t.models.some((model) => model.code === m.code) ); return { code: m.code, name: m.name, definition: m.definition, priority: m.priority, transformation: trans?.key ?? "UNKNOWN", }; }); const payload = { query, resultCount: enriched.length, results: enriched, }; return { content: [ { type: "text", text: JSON.stringify(payload, null, 2), }, ], structuredContent: payload, } as const; } );
  • Handler function executing the tool logic: invokes searchModels helper, handles errors, enriches results with transformation category, formats as MCP response with text and structured content.
    async ({ query }) => { const result = searchModels(query); if (!isOk(result)) { return { content: [ { type: "text", text: `Unable to search models: ${result.error.type}`, }, ], isError: true, } as const; } const enriched = result.value.map((m) => { const trans = Object.values(TRANSFORMATIONS).find((t) => t.models.some((model) => model.code === m.code) ); return { code: m.code, name: m.name, definition: m.definition, priority: m.priority, transformation: trans?.key ?? "UNKNOWN", }; }); const payload = { query, resultCount: enriched.length, results: enriched, }; return { content: [ { type: "text", text: JSON.stringify(payload, null, 2), }, ], structuredContent: payload, } as const; }
  • Input and output schemas for the search_models tool, defined using Zod: input requires 'query' string min length 2; output includes query echo, count, and array of model details with transformation.
    { title: "Search Mental Models", description: "Search HUMMBL mental models by keyword across codes, names, and definitions.", inputSchema: z.object({ query: z.string().min(2).describe("Search query (minimum 2 characters)"), }), outputSchema: z.object({ query: z.string(), resultCount: z.number(), results: z.array( z.object({ code: z.string(), name: z.string(), definition: z.string(), priority: z.number(), transformation: z.string(), }) ), }), },
  • Core searchModels helper function: performs case-insensitive substring search across all 120 mental models' code, name, and definition fields, returning Result of matching MentalModel[].
    export function searchModels(query: string): Result<MentalModel[], DomainError> { const lowerQuery = query.toLowerCase(); const results = getAllModels().filter( (m) => m.code.toLowerCase().includes(lowerQuery) || m.name.toLowerCase().includes(lowerQuery) || m.definition.toLowerCase().includes(lowerQuery) ); return ok(results); }

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