npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mollie/agent-toolkit

v0.3.1

Published

Use Mollie in AI agent frameworks — OpenAI, LangChain, Vercel AI SDK

Readme

@mollie/agent-toolkit

Use Mollie in AI agent frameworks – OpenAI, LangChain, and the Vercel AI SDK.

This package exposes Mollie API operations as tools your agent can call through function calling. It is framework-agnostic: the same toolkit converts to the tool format each framework expects.

Alpha — under active development. The public API may change between releases. Pin a version and read the changelog before upgrading.

⚠️ This toolkit can move money

Some tools (create_payment, create_refund) initiate real financial operations. When an LLM can call them, anything that reaches the prompt – including untrusted input such as a payment description or a customer email – can influence what the agent does. Two rules follow:

  1. Default to read-only. Pass an explicit tools allowlist and grant write tools only when the workflow needs them. Every example below does this.
  2. Confirm write operations. Put a human-in-the-loop (or your own server-side authorization) in front of any tool that creates a payment or refund. Do not let a model trigger these unattended.

Installation

npm install @mollie/agent-toolkit

Prerequisites

  • Node.js 18+
  • Mollie API credentials (see below)
  • The agent framework you intend to use (ai, openai, or langchain)

Authentication

The toolkit reads your credentials from the constructor. Supply them from the environment – never hardcode them, and never commit them.

export MOLLIE_API_KEY="test_xxxxxxxxxxxxxxxxxxxxxxxxxx"

Mollie credentials are environment-scoped:

  • test_… – operates against test mode. Use this while developing. Tool calls have no financial effect.
  • live_… – operates against your live account. A create_refund call with live credentials issues a real refund.

Start with test_ credentials. Switch to live_ only once you have confirmed the agent's behavior and have authorization controls around write tools.

Quickstart (Vercel AI SDK)

Read-only agent – safe to run first:

import { MollieAgentToolkit } from "@mollie/agent-toolkit";
import { toVercelAITools } from "@mollie/agent-toolkit/vercel-ai";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";

// Read-only allowlist. Add write tools only when needed.
const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment", "list_balances", "get_balance"],
});

const { text } = await generateText({
  model: openai("gpt-5.5"), // any AI SDK model provider works here
  tools: toVercelAITools(toolkit),
  prompt: "List my last 5 payments",
});

console.log(text);

The model is yours to choose – the toolkit does not depend on any particular provider or model. Swap in a different AI SDK provider as needed.

OpenAI Agents SDK

import { Agent, run, tool } from "@openai/agents";
import { MollieAgentToolkit } from "@mollie/agent-toolkit";

const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment"],
});

// MollieTool shape matches the agents SDK tool() signature directly.
const agentTools = toolkit.getTools().map((t) =>
  tool({
    name: t.name,
    description: t.description,
    parameters: t.parameters,
    execute: t.execute,
  }),
);

const agent = new Agent({
  name: "Payments Agent",
  model: "gpt-5.5",
  tools: agentTools,
});

const result = await run(agent, "List my last 5 payments");
console.log(result.finalOutput);

If you prefer the lower-level function calling API, use toOpenAITools and executeOpenAIToolCall from @mollie/agent-toolkit/openai.

LangChain

import { MollieAgentToolkit } from "@mollie/agent-toolkit";
import { toLangChainTools } from "@mollie/agent-toolkit/langchain";
import { ChatOpenAI } from "@langchain/openai";
import { createToolCallingAgent, AgentExecutor } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";

const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment"],
});
const tools = toLangChainTools(toolkit);

const llm = new ChatOpenAI({ model: "gpt-5.5" });
const prompt = ChatPromptTemplate.fromMessages([
  ["system", "You are an assistant that helps with Mollie payments."],
  ["human", "{input}"],
  ["placeholder", "{agent_scratchpad}"],
]);

const agent = createToolCallingAgent({ llm, tools, prompt });
const executor = new AgentExecutor({ agent, tools });

const result = await executor.invoke({ input: "List my last 5 payments" });
console.log(result.output);

Restricting available tools

The tools option controls exactly which operations the agent can call. Pass the smallest set the task needs. Omitting it exposes every tool, including write operations – not what you want for most agents.

// Read-only reporting agent
const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment", "list_balances", "get_balance"],
});
// Agent permitted to issue refunds – gate these calls behind confirmation
const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment", "create_refund"],
});

Available tools

| Tool | Type | Description | |---|---|---| | list_payments | Read | List recent payments | | get_payment | Read | Get a payment by ID | | create_payment | Write – moves money | Create a new payment | | list_refunds | Read | List refunds | | create_refund | Write – moves money | Refund a payment | | list_customers | Read | List customers | | get_customer | Read | Get a customer by ID | | create_customer | Write | Create a customer | | list_balances | Read | List account balances | | get_balance | Read | Get a balance by ID |

Read tools are safe to expose broadly. Treat every Write tool as privileged, and the two money-moving tools as requiring explicit authorization.

Error handling

Tool calls surface Mollie API errors to the caller: a failed operation rejects with the underlying error so your agent framework can handle, surface, or retry it. Validation and authentication failures (for example, wrong-mode credentials) are reported the same way. Wrap tool execution in your framework's error handling rather than assuming every call succeeds.

Links

License

MIT