Skip to content

Builtin Tools

Builtin tools are the actions a profile is allowed to take.

The mental model is simple:

  • A profile can only use the tools assigned to it
  • Different profiles can have different permissions
  • Tool access is one of the main ways you control risk

Platform admins assign tools to profiles from the dashboard.

Why tools matter

The same model behaves very differently depending on its tools.

For example:

  • A writing bot may need no tools at all
  • A research bot may need web search, web fetch, and knowledge base search
  • An ops bot may need file access and email
  • A power-user bot may need skills and MCP servers

Give each profile the minimum tool set it needs.

Default assignments

Nakama includes these builtins:

Tooldefault / super_botAll profilesNotes
write_fileYesYesAssigned to new custom profiles by default
delete_fileYesNo
edit_fileYesYesAssigned to new custom profiles by default
read_fileYesYesAssigned to new custom profiles by default
save_artifactYesNoPersistent output under artifacts/
search_filesYesYesAssigned to new custom profiles by default
knowledge_base_searchYesYesAssigned to new custom profiles by default
web_searchYesNo
web_fetchYesNo
update_profile_memoryYesYesAssigned to new custom profiles by default
archive_profile_memoryYesNo
emailYesNoOmitted at runtime when mailbox is unconfigured

New custom profiles receive read_file, write_file, edit_file, search_files, knowledge_base_search, and update_profile_memory until a platform admin assigns additional tools. System profiles (default, super_bot) get the full seeded set.

Choosing tools for a profile

Good starting patterns:

  • Simple chat bot: no extra tools
  • Research bot: web_search, web_fetch, knowledge_base_search
  • Knowledge bot: knowledge_base_search, update_profile_memory
  • Ops bot: file tools, save_artifact, email

Tool reference

write_file

Write text to a file in the profile workspace.

ParameterTypeRequiredNotes
pathstringYesRelative to profile workspace unless absolute
contentstringYesText to write
cwdstringNoBase directory within workspace; defaults to workspace root

Returns: { path, bytesWritten }

Scope: ~/.nakama/orgs/{orgId}/profiles/{profileId}/ and ~/.nakama/tools/ (custom JS modules)

Availability: When assigned to the profile.

delete_file

Delete a file from the profile workspace or custom tools directory.

ParameterTypeRequiredNotes
pathstringYesMust be within allowed directories
cwdstringNoBase directory within workspace

Returns: { path, deleted: true }

Scope: Profile workspace and custom tools directory only.

Availability: When assigned to the profile.

edit_file

Edit an existing text file in the profile workspace using exact replacements.

ParameterTypeRequiredNotes
pathstringYesRelative to profile workspace unless absolute
editsarrayYesOne or more { oldText, newText } replacements
cwdstringNoBase directory within workspace

Each oldText must be present once and edits must not overlap. Nakama applies all edits against the original file, then writes the result atomically after validation.

Returns: { path, replacements, bytesWritten, fuzzyMatches }

Scope: Profile workspace and custom tools directory only.

Availability: When assigned to the profile.

read_file

Read text from a file in the profile workspace.

ParameterTypeRequiredNotes
pathstringYesRelative to profile workspace unless absolute
cwdstringNoBase directory within workspace
offsetnumberNo1-based start line; default 1
limitnumberNoMaximum lines to return

Returns: { path, content, bytesRead, startLine, endLine, totalLines, truncated }

Scope: Profile workspace and custom tools directory. Reading config.ini by basename is blocked.

Availability: When assigned to the profile.

save_artifact

Save a persistent output file for the active profile. Use this when the agent wants to keep a report, summary, generated code file, image, PDF, or other work result beyond the current session.

ParameterTypeRequiredNotes
filenamestringYesRelative path under the profile's artifacts/ directory
contentstringYesRaw text for text mode, base64 payload for base64 mode
mime_typestringYesMIME type such as text/markdown, image/png, or application/pdf
modestringNotext or base64; default text

Returns: { filename, path, mimeType, mode, bytesWritten }

Behavior: Creates parent directories as needed and stores files under:

text
~/.nakama/orgs/{orgId}/profiles/{profileId}/artifacts/

Use text mode for markdown, logs, code snippets, and plain text. Use base64 mode for binary files such as images and PDFs.

Availability: When assigned to the profile.

search_files

Search text in files under the profile workspace.

ParameterTypeRequiredNotes
querystringYesKeyword or regex pattern
pathstringNoSubdirectory or file within workspace
globstringNoRipgrep glob filter (e.g. *.md)
regexbooleanNoTreat query as regex; default true
maxResultsnumberNoDefault 50, max 200

Returns: { query, root, matches, matchCount, truncated }

Scope: ~/.nakama/orgs/{orgId}/profiles/{profileId}/ only. Requires rg (ripgrep) on PATH.

Availability: When assigned to the profile.

Search uploaded knowledge base documents for relevant facts. The Knowledge tab can also show inherited URL sources, such as the Nakama documentation; use web_fetch or web_search for those URL sources.

ParameterTypeRequiredNotes
querystringYesKeyword or regex pattern
filenamestringNoFilter to one source document (e.g. report.pdf)
regexbooleanNoDefault true
maxResultsnumberNoDefault 50, max 200

Returns: { query, root, matches, matchCount, truncated } — empty matches when no ready document matches the filter.

Scope: Extracted text files stored under ~/.nakama/orgs/{orgId}/profiles/{profileId}/knowledge-base/.

Availability: When assigned and at least one uploaded document has status: "ready". Inherited URL sources do not require knowledge_base_search; they require web_fetch or web_search.

Search the web for current information.

ParameterTypeRequiredNotes
querystringYesSearch query

Availability: When assigned and the configured provider is OpenAI or Anthropic with a valid API key. Not available on OpenRouter. On Gemini, web search is disabled when other local tools are present on the same turn.

web_fetch

Fetch a single public HTTP(S) URL and return its content. HTML pages are converted to Markdown. Use for retrieving a known URL; use web_search when you need to discover sources.

ParameterTypeRequiredNotes
urlstringYesAbsolute http:// or https:// URL
rawbooleanNoWhen true, return raw body without Markdown conversion; default false

Returns: { url, finalUrl, status, contentType, bytes, content }

Behavior: Follows up to 5 redirects. Request timeout 30s. Maximum response body 1 MB.

Scope: Public internet addresses only. Private, reserved, and localhost targets are blocked.

Availability: When assigned to the profile.

update_profile_memory

Record a fact, preference, or decision in the profile's MEMORY.md.

ParameterTypeRequiredNotes
contentstringYesFact or observation to remember

Returns: { path, bytesTotal }

Behavior: Appends under a dated ## YYYY-MM-DD section in ~/.nakama/orgs/{orgId}/profiles/{profileId}/MEMORY.md.

Limits: 4096 bytes total file size.

Availability: When assigned to the profile.

archive_profile_memory

Move facts out of active MEMORY.md into memory-archive/ without deleting them.

ParameterTypeRequiredNotes
entriesstring[]YesExact bullet texts to archive (1–20 items)
reasonstringNoOptional note stored as an HTML comment in the archive file

Returns: { archived, activeBytes, archivePath }

Behavior: Removes matching bullets from MEMORY.md and appends them to ~/.nakama/orgs/{orgId}/profiles/{profileId}/memory-archive/YYYY-MM.md. Archived content is not loaded into the system prompt. Use search_files or read_file to retrieve it later.

Availability: When assigned to the profile.

email

List, read, search, and send email through the deployment mailbox configured in Settings.

ParameterTypeRequiredNotes
actionstringYeslist, read, search, or send
folderstringNoMailbox folder; default INBOX
limitnumberNoFor list/search; default 20, max 100
uidnumberYes for readIMAP UID
querystringYes for searchSubject/from/body search
tostringYes for sendSingle recipient
subjectstringFor sendEmail subject
textstringFor sendPlain text body
htmlstringNoOptional HTML body for send

Returns: Structured JSON with messages, message, or sent — or { error: "..." } on failure. Send body max 256 KB.

Availability: When assigned and the [email] section in ~/.nakama/config.ini is complete. Omitted at runtime when incomplete (omitUnavailableBuiltinTools).

Configuration prerequisites

Email

The email tool uses a deployment-global mailbox. Required keys in ~/.nakama/config.ini under [email]:

  • imap_host, smtp_host
  • username, password
  • Resolvable from address
  • TLS flags as needed

Org admins configure these from the web System → Tools page.

Web search

Requires an OpenAI or Anthropic provider with a configured API key.

Knowledge base

Upload documents via the profile dashboard or API. Search only indexes extracted text from documents with status: "ready". Upload path: ~/.nakama/orgs/{orgId}/profiles/{profileId}/knowledge-base/.

Data portability

Platform admins can export and import the whole local Nakama data root from Agent → System → Data in the dashboard. Use Export ZIP to download a backup. Exports are .zip backups and should be handled as sensitive files because they can include local auth, provider configuration, custom tools, skills, profile workspaces, and a local SQLite database.

Import first previews the ZIP manifest and restore impact. Confirmed restore replaces the current local data root; selective merge, scheduled backups, cloud destinations, and encrypted archives are not part of the first version.

Safety boundaries

File tools (read_file, write_file, delete_file) are scoped to:

  • Profile workspace: ~/.nakama/orgs/{orgId}/profiles/{profileId}/ (soul files, knowledge base, etc.)
  • Custom tools directory: ~/.nakama/tools/ (follows NAKAMA_CONFIG_DIR if set)

save_artifact is more specific: it only writes under ~/.nakama/orgs/{orgId}/profiles/{profileId}/artifacts/.

Path guards enforce:

  • 10 MB maximum file size for reads and writes
  • No path traversal outside allowed directories
  • No reads of config.ini by basename
  • Blocked special paths (/dev/, /proc/, /sys/)

All builtin tool IDs are protected and cannot be deleted from the dashboard.

Next steps

  • MCP servers — extend a profile with external tools via the Model Context Protocol
  • Profiles — how to design each bot
  • Multi-tenancy — who can assign tools and manage access

Released under the MIT License.