ToolsMadeToolCreateRequest tools.made-tool-create-request@1

Generated at from openvibe-contracts v0.443.0 and openvibe-sdk v0.177.0.

Version
1.0.0
Owner
tools
Visibility
public
Status
active
Compatibility
backward
Schema
https://openvibe.network/contracts/tools/made-tool-create-request.v1.json

Body of POST /api/v1/made-tools on openvibe.tools: a new tool a person makes (tools.made-tool@1), from the make page or, with capability tools.made.write and X-OV-Subject, by an agent on the person's behalf. A code tool sends its run(input) function as source_code (at most 64 KB; the entry and its SHA-256 are built from it) or a built entry as code. visibility defaults to private, and a tool an agent makes is always private: only the person publishes it. Answered 201 with the tool (tools.made-tool@1); refusals are problem+json: 400 tools.made.invalid (a field, in words, with its pointer), 401 token.*, 403 capability.denied, 409 tools.made.slug_taken.

Fields

FieldTypeRequiredDescriptionConstraints
slugstringyesA short name, unique among the owner's tools (summarize-email), for addresses and an agent's tool list.
  • pattern ^[a-z][a-z0-9-]{1,39}$
namestringyes
  • minLength 1
  • maxLength 80
summarystringyesOne plain sentence: what the tool does. Agents read it to decide when to use the tool.
  • minLength 1
  • maxLength 200
kindenumyesprompt: instructions run by a model through OpenVibe.AI. code: a JavaScript entry run as a skill-runner function job. chain (1.1.0): other tools run in order, each step's input from the chain's input or an earlier step.
  • one of "prompt", "code", "chain"
inputobjectyesJSON Schema (2020-12) of a run's input: an object schema.
input.typeconstyes
  • = "object"
outputobjectyes
  • no other fields
output.kindenumyesjson: result.data, checked against schema. text: result.text.
  • one of "json", "text"
output.schemaobjectJSON Schema of result.data. Required when kind is json.
output.schema.typeconstyes
  • = "object"
promptobject | nullA prompt tool's instructions and model; null for a code tool.
source_codestring | nullA code tool's JavaScript: a function run(input) that returns the answer (made/code.js checks it).
  • minLength 1
  • maxLength 65536
codeobject | nullA code tool's entry; null for a prompt tool.
chainobject | nullA chain tool's steps (1.1.0); absent or null for the other kinds.
netenumThe network a code tool may reach: none, the public internet (through the egress guard), or OpenVibe's own sites only. A prompt tool reaches no network (deny).
  • one of "deny", "public", "openvibe-only"
hostingenumWhere a code tool runs: OpenVibe's runner, the owner's own Link nodes, or nodes shared with others. A prompt tool runs on OpenVibe (openvibe).
  • one of "openvibe", "mine", "shared"
visibilityenum
  • one of "private", "unlisted", "public"

Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

Valid: chain-tool
{
  "slug": "shout-reply",
  "name": "Shout, then reply",
  "summary": "Upper-cases a message, then drafts a reply.",
  "kind": "chain",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  },
  "visibility": "private",
  "chain": {
    "steps": [
      {
        "tool": "upper",
        "input": {
          "text": "{{input.text}}"
        }
      },
      {
        "tool": "mtl_01J0000000000000000000000A",
        "input": {
          "text": "{{steps.0.text}}"
        }
      }
    ]
  }
}
Valid: code-tool-source
{
  "slug": "price-tax",
  "name": "Price with tax",
  "summary": "Adds sales tax to a price.",
  "kind": "code",
  "input": {
    "type": "object",
    "properties": {
      "price": {
        "type": "number"
      },
      "rate": {
        "type": "number"
      }
    },
    "required": [
      "price",
      "rate"
    ]
  },
  "output": {
    "kind": "json",
    "schema": {
      "type": "object",
      "properties": {
        "total": {
          "type": "number"
        }
      }
    }
  },
  "source_code": "function run(input) { return { total: Math.round(input.price * (1 + input.rate / 100) * 100) / 100 }; }"
}
Valid: prompt-tool
{
  "slug": "reply-kindly",
  "name": "Reply kindly",
  "summary": "Drafts a kind reply to a message.",
  "kind": "prompt",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  },
  "prompt": {
    "instructions": "Write a short, kind reply to the message.",
    "model": "auto"
  }
}
Rejected: code-without-code
{
  "slug": "calc",
  "name": "Calc",
  "summary": "Calculates.",
  "kind": "code",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  }
}
Rejected: extra-field
{
  "slug": "reply",
  "name": "Reply",
  "summary": "Replies.",
  "kind": "prompt",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  },
  "prompt": {
    "instructions": "Reply.",
    "model": "auto"
  },
  "owner": "usr_someone"
}
Rejected: prompt-with-source
{
  "slug": "reply",
  "name": "Reply",
  "summary": "Replies.",
  "kind": "prompt",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  },
  "prompt": {
    "instructions": "Reply.",
    "model": "auto"
  },
  "source_code": "function run(input) { return ''; }"
}
Rejected: prompt-without-prompt
{
  "slug": "reply",
  "name": "Reply",
  "summary": "Replies.",
  "kind": "prompt",
  "input": {
    "type": "object",
    "properties": {
      "text": {
        "type": "string",
        "title": "Text"
      }
    },
    "required": [
      "text"
    ]
  },
  "output": {
    "kind": "text"
  }
}

Validate

const contracts = require('openvibe-contracts');
contracts.validate('tools.made-tool-create-request@1', value);   // { valid, errors: [{ path, message }] }