Skip to main content
Glama

sb_function

Destructive

Create, update, remove, test, and inspect server-side TypeScript/JavaScript functions with secrets, collections, fetch, logs, and usage for site backend logic.

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.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "sb_function"
  }
}

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. Changed1 schema field changedv0.116.0
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
  2. Addedv0.104.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true and openWorldHint=true; the description usefully adds that access is owner/admin only and that set with an id merges rather than replaces. It omits the dry_run switch, which is the most important behavioral detail for a destructive multi-action tool, and says nothing about what test or logs return.

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?

Front-loads the resource and hosting model, then packs the action map into one dense trailing sentence — nearly every clause carries information. The heavy parenthetical nesting makes it harder to scan than a short bulleted action list would be, but nothing is wasted.

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 a 17-parameter, destructive, multi-action tool with no output schema, the description covers the action surface and the auth requirement but not the remaining field semantics or any hint at return shape for logs/usage/test. An agent could pick the right action but would still be guessing on several parameters.

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 coverage is only 6% across 17 parameters, so the description must carry the load; it does explain id, key, value, method, path, query, headers, cookies and body contextually by action. It leaves roughly half the parameters unexplained, including slug, content, language, enabled, limit, site_id and dry_run, so the compensation is substantial but incomplete.

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?

Opens with a concrete resource definition — server-side TS/JS functions served at /_wb/fn/<slug> with access to secrets, collections and fetch — and explicitly routes away from the sibling sb_code. An agent can identify the resource and its hosting model without opening the 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?

The description enumerates every action with its triggering semantics (set with no id creates, with id merges; remove takes an id or a secret key; secret with no key lists), which is strong action-level routing, and it names the sb_code exclusion. It does not, however, state the general condition for choosing this tool over other backend siblings such as sb_api_call.

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