Cotlet: save a Custom API endpoint
cotlet_api_saveSaves a tested script as the user's endpoint (an existing name: its new version) and answers its URL, a curl example and the OpenAPI link. Show the user the test's JSON first. An endpoint that writes waits until the user allows the writes in the console: give them the link this answers.
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": {
"name": "<name>",
"description": "<description>",
"site": "<site>",
"script": "<script>",
"input_schema": "<input_schema>",
"output_schema": "<output_schema>"
},
"name": "cotlet_api_save"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The endpoint's name, e.g. latest_posts. | |
| note | No | For a new version: what changed, one line. | |
| site | Yes | The app's site, e.g. substack.com: ctx.http reaches it and its subdomains. | |
| script | Yes | The Python script: `def run(ctx):` returning the answer (see the guide). | |
| description | Yes | What it does, one line. | |
| input_schema | Yes | JSON Schema of the input, an object (type, properties, items, required). | |
| output_schema | Yes | JSON Schema of the answer (type, properties, items, required). |