
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@supermemory/tools
Advanced tools
Memory tools for AI SDK and OpenAI function calling with supermemory.
This package provides supermemory tools for both AI SDK and OpenAI function calling through dedicated submodule exports, each with function-based architectures optimized for their respective use cases.
npm install @supermemory/tools
The package provides two submodule imports:
@supermemory/tools/ai-sdk - For use with the AI SDK framework@supermemory/tools/openai - For use with OpenAI's function callingimport { supermemoryTools, searchMemoriesTool, addMemoryTool } from "@supermemory/tools/ai-sdk"
import { createOpenAI } from "@ai-sdk/openai"
import { generateText } from "ai"
const openai = createOpenAI({
apiKey: process.env.OPENAI_API_KEY!,
})
// Create all tools
const tools = supermemoryTools(process.env.SUPERMEMORY_API_KEY!, {
projectId: "your-project-id",
})
// Use with AI SDK
const result = await generateText({
model: openai("gpt-4"),
messages: [
{
role: "user",
content: "What do you remember about my preferences?",
},
],
tools,
})
// Or create individual tools
const searchTool = searchMemoriesTool(process.env.SUPERMEMORY_API_KEY!, {
projectId: "your-project-id",
})
const addTool = addMemoryTool(process.env.SUPERMEMORY_API_KEY!, {
projectId: "your-project-id",
})
import { supermemoryTools, getToolDefinitions, createToolCallExecutor } from "@supermemory/tools/openai"
import OpenAI from "openai"
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY!,
})
// Get tool definitions for OpenAI
const toolDefinitions = getToolDefinitions()
// Create tool executor
const executeToolCall = createToolCallExecutor(process.env.SUPERMEMORY_API_KEY!, {
projectId: "your-project-id",
})
// Use with OpenAI Chat Completions
const completion = await client.chat.completions.create({
model: "gpt-4",
messages: [
{
role: "user",
content: "What do you remember about my preferences?",
},
],
tools: toolDefinitions,
})
// Execute tool calls if any
if (completion.choices[0]?.message.tool_calls) {
for (const toolCall of completion.choices[0].message.tool_calls) {
const result = await executeToolCall(toolCall)
console.log(result)
}
}
// Or create individual function-based tools
const tools = supermemoryTools(process.env.SUPERMEMORY_API_KEY!, {
projectId: "your-project-id",
})
const searchResult = await tools.searchMemories({
informationToGet: "user preferences",
limit: 10,
})
const addResult = await tools.addMemory({
memory: "User prefers dark roast coffee",
})
Both modules accept the same configuration interface:
interface SupermemoryToolsConfig {
baseUrl?: string
containerTags?: string[]
projectId?: string
}
Searches through stored memories based on a query string.
Parameters:
informationToGet (string): Terms to search forincludeFullDocs (boolean, optional): Whether to include full document content (default: true)limit (number, optional): Maximum number of results (default: 10)Adds a new memory to the system.
Parameters:
memory (string): The content to rememberRetrieves a specific memory by ID.
Parameters:
memoryId (string): The ID of the memory to fetchThis package uses a function-based architecture throughout, even for the OpenAI integration. This provides:
Make sure to set the following environment variables:
SUPERMEMORY_API_KEY=your_supermemory_api_key
OPENAI_API_KEY=your_openai_api_key # if using OpenAI
SUPERMEMORY_BASE_URL=https://your-custom-url # optional
npm test
Tests require the environment variables to be set up properly.
FAQs
Memory tools for AI SDK, OpenAI, Voltagent and Mastra with supermemory
The npm package @supermemory/tools receives a total of 6,428 weekly downloads. As such, @supermemory/tools popularity was classified as popular.
We found that @supermemory/tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.