Variable: tools
@providerprotocol/ai / moonshot / tools
Variable: tools
Section titled “Variable: tools”
consttools:object
Defined in: src/providers/moonshot/types.ts:700
Moonshot builtin tools factory object. Provides convenient access to all builtin tool creators.
Note: The excel plugin tool uses a different format and is not included here.
It requires file IDs from the Moonshot file upload API.
Type Declaration
Section titled “Type Declaration”base64()
Section titled “base64()”base64: () =>
MoonshotTool=base64Encode
Alias for base64Encode
Creates a Base64 encoding tool (server-side execution).
Returns
Section titled “Returns”base64Decode()
Section titled “base64Decode()”base64Decode: () =>
MoonshotTool
Base64 decoding
Creates a Base64 decoding tool (server-side execution).
Returns
Section titled “Returns”base64Encode()
Section titled “base64Encode()”base64Encode: () =>
MoonshotTool
Base64 encoding
Creates a Base64 encoding tool (server-side execution).
Returns
Section titled “Returns”codeRunner()
Section titled “codeRunner()”codeRunner: () =>
MoonshotTool
Python code execution with matplotlib, pandas support
Creates a Python code runner tool (server-side execution). Allows execution of Python code for calculations and data processing. Supports print output, matplotlib plots, pandas, and file reading via ctx.read_object().
Returns
Section titled “Returns”convert()
Section titled “convert()”convert: () =>
MoonshotTool
Unit conversion (length, mass, temperature, currency, etc.)
Creates a unit conversion tool (server-side execution). Supports length, mass, volume, temperature, area, time, energy, pressure, speed, and currency conversions.
Returns
Section titled “Returns”date()
Section titled “date()”date: () =>
MoonshotTool
Date/time processing and timezone conversion
Creates a date/time processing tool (server-side execution). Handles date and time calculations, timezone conversion, and formatting.
Returns
Section titled “Returns”fetch()
Section titled “fetch()”fetch: () =>
MoonshotTool
URL content fetching with markdown extraction
Creates a URL fetch tool (server-side execution). Extracts content from URLs and formats it as Markdown.
Returns
Section titled “Returns”memory()
Section titled “memory()”memory: () =>
MoonshotTool
Memory storage and retrieval system
Creates a memory storage tool (server-side execution). Supports persistent storage of conversation history and user preferences.
Returns
Section titled “Returns”mew: () =>
MoonshotTool
Cat meowing and blessings generator
Creates a cat meowing/blessing tool (server-side execution). Returns random cat meowing sounds and blessings based on mood.
Returns
Section titled “Returns”quickjs()
Section titled “quickjs()”quickjs: () =>
MoonshotTool
JavaScript execution via QuickJS engine
Creates a QuickJS JavaScript execution tool (server-side execution). Enables secure JavaScript code execution via the QuickJS engine.
Returns
Section titled “Returns”randomChoice()
Section titled “randomChoice()”randomChoice: () =>
MoonshotTool
Random selection with optional weights
Creates a random choice tool (server-side execution). Enables random selection from options with optional weights.
Returns
Section titled “Returns”rethink()
Section titled “rethink()”rethink: () =>
MoonshotTool
Intelligent reasoning/reflection tool
Creates an intelligent reasoning tool (server-side execution). Allows the model to organize thoughts and plan before responding.
Returns
Section titled “Returns”webSearch()
Section titled “webSearch()”webSearch: () =>
MoonshotTool
Web search for real-time internet information
Creates a web search tool (server-side execution). Enables real-time internet search capabilities.
Note: Web search is charged separately from regular API usage.
Returns
Section titled “Returns”Example
Section titled “Example”import { moonshot, tools } from '@providerprotocol/ai/moonshot';
const model = llm({ model: moonshot('kimi-k2.5'), params: { tools: [tools.webSearch()], },});Example
Section titled “Example”import { moonshot, tools } from '@providerprotocol/ai/moonshot';
const model = llm({ model: moonshot('kimi-k2.5'), params: { tools: [ tools.webSearch(), tools.codeRunner(), tools.fetch(), ], },});