Skip to main content
Glama

ad4m_classify

Determines the correct layer (ad4m, local, env, or relay) for a piece of information before storing it in memory. Run this to avoid misclassification when writing memory.

Instructions

Classify a piece of information by which layer it belongs to: ad4m, local, env, or relay. Run this BEFORE ad4m_write_memory if unsure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesThe information or description to classify

Implementation Reference

  • The handler function for the ad4m_classify tool. It receives the 'content' argument, calls classifyContent() to determine the layer classification, and returns the result.
    async function classify({ content }) {
      const result = classifyContent(content);
      return ok(result);
    }
  • index.js:79-91 (handler)
    The core classification logic. It lowercases the input and matches it against keyword-based rules in the TAXONOMY object (env, local, relay, ad4m layers). Falls back to 'ad4m' if no keywords match.
    function classifyContent(content) {
      const lower = content.toLowerCase();
      for (const [layer, cfg] of Object.entries(TAXONOMY)) {
        if (cfg.keywords.some((kw) => lower.includes(kw))) {
          return { layer, reason: cfg.reason, action: cfg.action };
        }
      }
      return {
        layer:  "ad4m",
        reason: "No exclusion pattern matched — defaulting to semantic memory.",
        action: "Use ad4m_write_memory. If uncertain, run ad4m_classify with more specific content.",
      };
    }
  • TypeScript version of the core classification logic with proper type annotations (Layer, LayerRule).
    function classifyContent(content: string): { layer: Layer; reason: string; action: string } {
      const lower = content.toLowerCase();
      for (const [layer, cfg] of Object.entries(TAXONOMY) as [Layer, LayerRule][]) {
        if (cfg.keywords.some((kw) => lower.includes(kw))) {
          return { layer, reason: cfg.reason, action: cfg.action };
        }
      }
      return {
        layer:  "ad4m",
        reason: "No exclusion pattern matched — defaulting to semantic memory.",
        action: "Use ad4m_write_memory. If uncertain, run ad4m_classify with more specific content.",
      };
    }
  • The tool registration and schema definition (TypeScript version). Defines the 'content' input as a required string using Zod. The handler inline calls classifyContent().
    // 7. ad4m_classify
    server.tool("ad4m_classify",
      "Classify a piece of information by which layer it belongs to: ad4m, local, env, or relay. Run this BEFORE ad4m_write_memory if unsure.",
      { content: z.string().describe("The information or description to classify") },
      async ({ content }) => ok(classifyContent(content))
    );
  • index.js:576-585 (registration)
    Tool registration in the compiled index.js (ListToolsRequestSchema handler). Defines the tool name, description, and JSON Schema input.
      name: "ad4m_classify",
      description: "Classify a piece of information by which layer it belongs to: ad4m (semantic memory), local (CLAUDE.md/settings), env (credentials), or relay (cross-terminal). Run this BEFORE ad4m_write_memory if unsure where something belongs.",
      inputSchema: {
        type: "object",
        properties: {
          content: { type: "string", description: "The information or description to classify" },
        },
        required: ["content"],
      },
    },
  • index.js:667-667 (registration)
    The CallToolRequestSchema case routing 'ad4m_classify' to the classify handler function.
    case "ad4m_classify":           return { content: await classify(args) };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses the action and layers but does not mention whether the tool is read-only, requires authentication, rate limits, or any side effects. Minimal behavioral context beyond the core functionality.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences: first states the action and resource, second provides a usage tip. No redundant information, front-loaded with key purpose, and every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity (one parameter, no output schema), the description covers purpose and categories but lacks information about the return value format or structure. Since there is no output schema, the description should ideally describe the output to make the tool fully usable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% coverage with a description for the single parameter 'content'. The description adds value by enumerating the classification categories (ad4m, local, env, relay), which the schema does not provide. Could be improved by specifying expected format or examples.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'classify' and the resource 'piece of information', lists the possible layers (ad4m, local, env, relay), and distinguishes from sibling tool ad4m_write_memory by suggesting to run this first if unsure.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use this tool ('Run this BEFORE ad4m_write_memory if unsure'), providing clear context. However, it does not explicitly mention when not to use it or other alternatives beyond the one sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/thefranceway/mcp-ad4m'

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