Skip to main content
Glama

sb_function

Destructive

Create, update, test, and monitor server-side TypeScript/JavaScript functions that access site secrets, collections, and fetch; manage logs, usage, and secrets for owner/admin use.

Instructions

Backend functions: server-side TS/JS at /wb/fn/ with the site's secrets, collections and fetch ("" slug = importable module). Not sb_code. action: list | get | set (no id creates; id merges) | remove (id, or secret key) | test (method/path/query/headers/cookies/body) | logs | usage | secret (no key lists; key+value sets). Owner/admin only.

Input Schema

NameRequiredDescriptionDefault
idNologs: filters to it
keyNo
bodyNo
pathNo
slugNo
limitNo
queryNo
valueNo
actionYes
methodNo
contentNo
cookiesNo
dry_runNo
enabledNo
headersNo
site_idNo
languageNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.104.0

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already flag destructiveHint and openWorldHint, and the description adds real value on top: it discloses the permission model, that functions run with the site's secrets/collections/fetch, that 'remove' deletes, and that 'test' actually invokes the function with a method/path/body. It does not explain dry_run, which is the one safety-relevant gap for a destructive tool with a test path.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely dense but earns nearly every token; the resource definition and the sb_code exclusion are front-loaded before the action map. The action list is crammed into a single run-on clause, which slows parsing for a 17-parameter tool but wastes little space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an eight-action, 17-parameter tool with no output schema, the description covers the core dispatch logic and the risky operations well. It falls short on parameters that gate behavior (dry_run, enabled, language, site_id) and does not say what list/get/logs/usage return, leaving genuine holes.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 6% (only 'id' is annotated), so the description has to carry the load and it does for the ambiguous cases: id-vs-create/merge on set, key+value on secret, and the full test payload shape. However six parameters (dry_run, enabled, language, content, limit, site_id) are never mentioned anywhere, including the limit's 1-200 bound, so an agent still guesses at them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The definition names the resource and its runtime ('server-side TS/JS at /_wb/fn/<slug>') and immediately differentiates it from the nearest confusable sibling with 'Not sb_code'. An agent can decide between sb_function and sb_code without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit exclusion (not sb_code) and an authorization precondition ('Owner/admin only'), plus action-level guidance embedded in the list (no id creates; id merges). What is missing is any statement of when a given action should be chosen over a sibling like sb_add or sb_set, which is left implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.