Files
mesh-catalog/modules/letta/tools/index.ts
T
jschoubben 515b1e79c7 Convert baserow, letta, invoicing to mesh catalog DB consumers
Mirror the postgres-consumer shape (keycloak/nextcloud): requires the
backing service(s), binds/secrets for the delivered credential, and a
server container that reads it from an interpolated env file.

- baserow: consumes postgres-database + redis-cache; tooled (dormant
  until an account is configured, like gitea's token).
- letta: consumes postgres-database; tooled, live via a mesh-minted
  server-password injected into both server and runtime.
- invoicing: consumes mongodb-database + s3-bucket; plain two-container
  service (app + api), no tools.

Digests pinned for baserow and letta; invoicing keeps private-registry
tags (DIGEST-UNRESOLVED). redis-cache and mongodb-database consumer
shapes are inferred (no prior consumer in the catalog).

Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
2026-09-06 01:12:50 +02:00

52 lines
1.8 KiB
TypeScript

// letta's tools — letta's own code (novox/hq ADR 0039). They import letta's own client (../client)
// and plug into the mesh through the sdk's tool harness. Editing them rebuilds letta and nothing
// else. Absent a password they yield no tools rather than a failure.
import { registerModuleTools, type ToolDefinition } from "@novox/mesh-sdk/tools";
import { LettaClient } from "../client.js";
export function getLettaTools(letta: LettaClient): ToolDefinition[] {
return [
{
name: "letta_list_agents",
description: "List the Letta agents on the server.",
input: {},
run: async () => ({ agents: await letta.listAgents() }),
},
{
name: "letta_get_messages",
description: "Fetch recent messages from a Letta agent's conversation.",
input: {
agent_id: { type: "string", description: "the agent id" },
limit: { type: "number", description: "max messages to return (default 20)" },
},
run: async (args) => {
const agentId = String(args.agent_id);
const limit = args.limit ? Number(args.limit) : 20;
return { messages: await letta.getMessages(agentId, limit) };
},
},
{
name: "letta_send_message",
description: "Send a user message to a Letta agent and return its reply.",
input: {
agent_id: { type: "string", description: "the agent id" },
text: { type: "string", description: "the message to send" },
},
run: async (args) => {
const agentId = String(args.agent_id);
const text = String(args.text);
return { reply: await letta.sendMessage(agentId, text) };
},
},
];
}
registerModuleTools("letta", (env) => {
try {
return getLettaTools(LettaClient.fromEnv(env));
} catch {
return [];
}
});