Skip to main content
Glama

relay_read

Fetch stored relay messages between terminals in AD4M. Filter results by session ID or specify a timestamp to retrieve only messages after a certain time.

Instructions

Read cross-terminal relay messages from AD4M. Optionally filter by session_id or since a timestamp.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
perspective_uuidYesPerspective UUID (use ClaudeMemory UUID)
session_idNoFilter to a specific terminal/session
sinceNoISO timestamp — only return messages after this time

Implementation Reference

  • Handler function for relay_read tool: queries links with predicate 'franc://relay', optionally filters by session_id and since timestamp, returns sorted relay messages.
      async ({ perspective_uuid, session_id, since }) => {
        const query: Record<string, string> = { predicate: "franc://relay" };
        if (session_id) query.source = `franc://relay/${session_id}`;
        const data = await gql(
          `query Q($uuid: String!, $q: LinkQuery!) {
             perspectiveQueryLinks(uuid: $uuid, query: $q) {
               author timestamp data { source predicate target }
             }
           }`,
          { uuid: perspective_uuid, q: query }
        );
        let links = data.perspectiveQueryLinks as LinkExpr[];
        if (since) {
          const cutoff = new Date(since).getTime();
          links = links.filter((l) => new Date(l.timestamp).getTime() > cutoff);
        }
        links.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
        return ok(links.map((l) => ({
          session_id: l.data.source.replace("franc://relay/", ""),
          message:    l.data.target.replace("literal://", ""),
          timestamp:  l.timestamp,
          author:     l.author,
        })));
      }
    );
  • Tool registration with Zod schema for relay_read: perspective_uuid (required), session_id (optional), since (optional ISO timestamp).
    server.tool("relay_read",
      "Read cross-terminal relay messages from AD4M. Optionally filter by session_id or since a timestamp.",
      {
        perspective_uuid: z.string().describe("Perspective UUID (use ClaudeMemory UUID)"),
        session_id:       z.string().optional().describe("Filter to a specific terminal/session"),
        since:            z.string().optional().describe("ISO timestamp — only return messages after this time"),
      },
      async ({ perspective_uuid, session_id, since }) => {
        const query: Record<string, string> = { predicate: "franc://relay" };
        if (session_id) query.source = `franc://relay/${session_id}`;
        const data = await gql(
          `query Q($uuid: String!, $q: LinkQuery!) {
             perspectiveQueryLinks(uuid: $uuid, query: $q) {
               author timestamp data { source predicate target }
             }
           }`,
          { uuid: perspective_uuid, q: query }
        );
        let links = data.perspectiveQueryLinks as LinkExpr[];
        if (since) {
          const cutoff = new Date(since).getTime();
          links = links.filter((l) => new Date(l.timestamp).getTime() > cutoff);
        }
        links.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
        return ok(links.map((l) => ({
          session_id: l.data.source.replace("franc://relay/", ""),
          message:    l.data.target.replace("literal://", ""),
          timestamp:  l.timestamp,
          author:     l.author,
        })));
      }
    );
  • src/index.ts:485-517 (registration)
    Registration of relay_read as tool #13 on the MCP server using server.tool().
    // 13. relay_read
    server.tool("relay_read",
      "Read cross-terminal relay messages from AD4M. Optionally filter by session_id or since a timestamp.",
      {
        perspective_uuid: z.string().describe("Perspective UUID (use ClaudeMemory UUID)"),
        session_id:       z.string().optional().describe("Filter to a specific terminal/session"),
        since:            z.string().optional().describe("ISO timestamp — only return messages after this time"),
      },
      async ({ perspective_uuid, session_id, since }) => {
        const query: Record<string, string> = { predicate: "franc://relay" };
        if (session_id) query.source = `franc://relay/${session_id}`;
        const data = await gql(
          `query Q($uuid: String!, $q: LinkQuery!) {
             perspectiveQueryLinks(uuid: $uuid, query: $q) {
               author timestamp data { source predicate target }
             }
           }`,
          { uuid: perspective_uuid, q: query }
        );
        let links = data.perspectiveQueryLinks as LinkExpr[];
        if (since) {
          const cutoff = new Date(since).getTime();
          links = links.filter((l) => new Date(l.timestamp).getTime() > cutoff);
        }
        links.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());
        return ok(links.map((l) => ({
          session_id: l.data.source.replace("franc://relay/", ""),
          message:    l.data.target.replace("literal://", ""),
          timestamp:  l.timestamp,
          author:     l.author,
        })));
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool is read-only, but lacks details on side effects, rate limits, authentication needs, or return behavior. For a tool with no annotations, this is insufficient.

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?

The description is two sentences, no fluff, and front-loaded with the primary action. Every word 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?

The tool has 3 parameters and no output schema. The description explains the purpose and optional filters, but does not mention output format, pagination, or error behavior. Given the lack of annotations, more detail would be beneficial.

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%; each parameter is described in the schema. The description merely summarizes the optional filters without adding new semantics beyond what the schema already provides. Baseline 3 is appropriate.

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 'Read' and the resource 'cross-terminal relay messages from AD4M'. It also mentions optional filters, distinguishing it from the sibling 'relay_write' (write). This is specific and non-tautological.

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

Usage Guidelines3/5

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

The description implies use for reading vs writing, but does not explicitly state when to use this tool over alternatives or provide exclusion criteria. No mention of prerequisites or when not to use it.

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