Skip to main content
Glama

get_context

Retrieve architectural decisions to understand a project's codebase at the start of each session. Filter by category or search for specific decisions.

Instructions

Get all architectural decisions for this project. Call this at the START of every session to understand the codebase.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter by category (optional)
queryNoSearch for specific decisions (optional)

Implementation Reference

  • The 'get_context' tool logic, which retrieves and optionally filters architectural decisions from the lore store.
    if (name === "get_context") {
      const store = readStore();
    
      if (store.decisions.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "No architectural decisions recorded yet.\n\nRun `lore init` to extract decisions from existing code.",
            },
          ],
        };
      }
    
      let decisions = store.decisions;
    
      // filter by category
      if (args?.category) {
        decisions = decisions.filter((d) =>
          d.category
            .toLowerCase()
            .includes((args.category as string).toLowerCase())
        );
      }
    
      // filter by query
      if (args?.query) {
        const q = (args.query as string).toLowerCase();
        decisions = decisions.filter(
          (d) =>
            d.decision.toLowerCase().includes(q) ||
            d.reason.toLowerCase().includes(q) ||
            d.category.toLowerCase().includes(q)
        );
      }
    
      const summary = decisions
        .map(
          (d) =>
            `[${d.category.toUpperCase()}] ${d.decision}\n` +
            `  → Reason: ${d.reason}\n` +
            `  → Constraints: ${
              d.constraints.length > 0
                ? d.constraints.join(", ")
                : "none"
            }`
        )
        .join("\n\n");
    
      return {
        content: [
          {
            type: "text",
            text:
              `LORE Context — ${decisions.length} decisions\n` +
              `${"─".repeat(40)}\n\n` +
              summary,
          },
        ],
      };
    }
  • src/index.ts:188-205 (registration)
    The registration of 'get_context' in the ListToolsRequestSchema handler.
    {
      name: "get_context",
      description:
        "Get all architectural decisions for this project. Call this at the START of every session to understand the codebase.",
      inputSchema: {
        type: "object",
        properties: {
          category: {
            type: "string",
            description: "Filter by category (optional)",
          },
          query: {
            type: "string",
            description: "Search for specific decisions (optional)",
          },
        },
      },
    },
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/EliotShift/lore-mcp'

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