Get a function

SDK platic.tools.functions.get()

Read a function's current draft code, latest verification, and secret-slot states. Secret values are not returned.

Example

await platic.tools.functions.get("fn_123");

Path parameters

ParameterTypeDescriptionRequired
functionIdstringFunction ID. When it is on, it is also its toolId✓

Response

{
  "status": "success",
  "data": {
    "id": "Hk2s9QmXc1",
    "name": "tax_id_lookup",
    "displayName": "Tax ID lookup",
    "description": "Looks up a customer's company name by tax ID. Use it when the customer gives their tax ID.",
    "status": "enabled",
    "source": "import { z } from \"zod\";\nimport { defineFunction } from \"@platica/functions\";\n\nexport default defineFunction({\n  input: z.object({\n    taxId: z.string().describe(\"Customer tax ID, 12 or 13 characters\"),\n  }),\n  async run(input, { http, secrets, log }) {\n    const res = await http.fetch(\"https://api.example.com/v1/tax-id\", {\n      method: \"POST\",\n      headers: { \"Content-Type\": \"application/json\", Authorization: `Bearer ${secrets.API_KEY}` },\n      body: JSON.stringify({ taxId: input.taxId }),\n    });\n    if (res.status !== 200) return { found: false };\n    log.info(\"response\", { status: res.status });\n    return { found: true, name: res.json().company_name };\n  },\n});\n",
    "draftChecksum": "sha256-3f1c9a…",
    "allowedDomains": ["api.example.com"],
    "timeoutSeconds": 20,
    "secretSlots": [
      { "slot": "API_KEY", "origin": "https://api.example.com" }
    ],
    "inputSchema": {
      "type": "object",
      "properties": {
        "taxId": { "type": "string", "description": "Customer tax ID, 12 or 13 characters" }
      },
      "required": ["taxId"]
    },
    "liveVersion": 1,
    "lastVerify": { "ok": true, "at": "2026-11-24T18:00:00.000Z", "issues": [] },
    "createdAt": "2026-11-24T17:50:00.000Z",
    "createdBy": "user:8sKd2LxQp0",
    "updatedAt": "2026-11-24T18:01:00.000Z",
    "updatedBy": "user:8sKd2LxQp0",
    "toolName": "fn_tax_id_lookup",
    "toolId": "Hk2s9QmXc1",
    "secrets": [
      {
        "slot": "API_KEY",
        "origin": "https://api.example.com",
        "state": "bound",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "nextStep": "Live (version 1). Connect it to an agent with PUT /v1/agents/{agentId}/tools/Hk2s9QmXc1; run it by hand with POST /v1/tools/functions/Hk2s9QmXc1/run. Changes to source stay in the draft until you publish again."
  }
}

Response fields

FieldTypeDescription
idstringFunction ID
namestringUnique name in the workspace. It cannot be changed
displayNamestringName for people
descriptionstringWhat it does and when to use it. It is what the agent reads to decide whether to call it
statusstringdraft, enabled or paused. See states
sourcestringThe draft's code. The list can leave it out
draftChecksumstring | nullFingerprint of the draft's last successful verification
allowedDomainsstring[]Hosts the code can call with http.fetch
timeoutSecondsintegerMaximum time of each execution, from 1 to 60
secretSlotsarrayThe declared slots: { slot, origin }
inputSchemaobject | nullThe JSON Schema the agent sees, from the last successful verification
liveVersioninteger | nullThe version agents use. null before the first publication
lastVerifyobject | nullThe last verification: ok, at and issues. null before the first one
createdAt, updatedAtstringISO 8601 dates
createdBy, updatedBystringWho created or changed it: api:<keyId> with an API key or user:<uid>
toolNamestringfn_<name>, the tool name agents see
toolIdstring | nullWhile it is on, the ID to connect a tool. It is the same id as the function's
secretsarrayEach slot with slot, origin, state (bound or missing) and secretId. Never the value
nextStepstringText in English that says what comes next. Do not program against its wording

Errors

Statusdetails.codeWhen
403FORBIDDENThe person behind the token does not have access to Integrations
404NOT_FOUNDThe function does not exist in this workspace

Notes

  • source is always the draft. The code of a published version is in versions.
  • If lastVerify.ok is false, each problem in lastVerify.issues has stage, line and message. See Verify a function.