Skip to main content
Glama

memory_poisoning_scanner__scan_text

Scans agent code for memory-poisoning risks: untrusted input written to persistent memory without sanitization and retrieved memory used as trusted context.

Instructions

Scan agent code for memory-poisoning risks: untrusted input written into persistent, cross-session memory (MemGPT-style archival/core memory, or a vector store used as a long-term knowledge base) without visible sanitization, and memory retrievals fed into a system/assistant-role message or prompt template as trusted context.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "content": "<content>"
    },
    "name": "memory_poisoning_scanner__scan_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
labelNoOptional label shown in findings (e.g. filename)
contentYesThe code content to scan

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.5
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  2. Addedv0.1.1

TDQS

A3.9/5.0
Behavior3/5

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

With no annotations, the description carries the full load. It makes clear this is a static content scan and defines the risk classes, but does not state whether code is executed, what findings/severity output looks like, or whether memory references require particular pattern fidelity. Useful risk definition, though behavioral details remain thin.

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

Conciseness4/5

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

Single front-loaded sentence beginning with the action and risk name, then elaborating the two patterns. Dense but every clause adds detection specificity; slightly long and unbroken by structure prevents a 5.

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

Completeness4/5

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

For a two-parameter scanner with no output schema, the description defines the risk surfaces thoroughly enough to know what it will catch. The main missing element is a hint about findings/output shape, but the risk definition compensates well.

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

Parameters3/5

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

Schema coverage is 100% and both parameters (content, optional label) are documented in the schema itself, so the description correctly adds no parameter syntax. Baseline 3 applies since the schema already does the work and the description adds nothing param-specific.

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?

States a specific verb (scan) and resource (agent code) and then precisely enumerates the two memory-poisoning patterns it detects: unsanitized untrusted input written to persistent cross-session memory, and retrieved memory injected into a trusted system/prompt context. This differentiates it cleanly from sibling scanners like prompt_injection_scanner__scan_text and tool_poisoning_scanner__scan_text.

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?

The detection scope makes it clear this tool is for code involving archival/core memory or long-term vector knowledge bases feeding prompts, which implicitly routes the agent away from the prompt-injection and tool-poisoning siblings. There is no explicit 'use X instead when Y' statement or note on when not to use it, so it falls short of a 5.

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

Deploy Server

Other Tools