Docstring Generator
Add docstrings to Python functions and classes, in Google, NumPy or Sphinx style.
Pay by wallet (x402) AI-generated
docstring-generate Example
Input
{
"code": "function hello() { return 'world'; }",
"style": "conventional"
} Answer
{
"note": "Input code is JavaScript, not Python. No Python docstrings can be added to non-Python code.",
"style": "conventional",
"documented_code": "function hello() { return 'world'; }",
"classes_documented": 0,
"functions_documented": 0
} Inputs
| Field | Type | Required | What it is |
|---|---|---|---|
code | string | Yes | — |
style | string | No | google/numpy/sphinx |
Output fields
How reliably each field appears in a successful answer.
| Field | Type | Appears |
|---|---|---|
style | string | Always (present in every successful answer) |
documented_code | string | Always (present in every successful answer) |
functions_documented | integer | Always (present in every successful answer) |
How to call it
The same tool through each route. MCP clients reach it through Strale’s server at https://api.strale.io/mcp; the call below is what the agent sends.
# Needs an API key. max_price_cents caps what this call may cost.
curl -X POST https://api.strale.io/v1/do \
-H "Authorization: Bearer $STRALE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"capability_slug": "docstring-generate",
"inputs": {
"code": "function hello() { return 'world'; }",
"style": "conventional"
},
"max_price_cents": 5
}' {
"tool": "strale_execute",
"arguments": {
"slug": "docstring-generate",
"inputs": {
"code": "function hello() { return 'world'; }",
"style": "conventional"
},
"max_price_cents": 5
}
} import { Strale } from "straleio";
const strale = new Strale({ apiKey: process.env.STRALE_API_KEY! });
const result = await strale.do({
capability_slug: "docstring-generate",
inputs: {
"code": "function hello() { return 'world'; }",
"style": "conventional"
},
max_price_cents: 5,
}); import os
from straleio import Strale, DoRequest
strale = Strale(api_key=os.environ["STRALE_API_KEY"])
result = strale.do(DoRequest(
capability_slug="docstring-generate",
inputs={
"code": "function hello() { return 'world'; }",
"style": "conventional",
},
max_price_cents=5,
)) # No account. The first request answers 402 with the price in USDC;
# an x402 client pays it from your wallet and repeats the request.
curl -i 'https://api.strale.io/x402/v2/docstring-generate?code=function+hello%28%29+%7B+return+%27world%27%3B+%7D&style=conventional' Limitations
Side effects and exception details can be missed
AI-generated docstrings — may not capture non-obvious side effects, thread safety, or exception behaviour
What to do instead: Review generated docstrings for accuracy and add implementation-specific warnings or notes manually
Related tools
- Agent Trace Analysis €0.20
- API Docs Generator €0.20
- API Mock Responses €0.05
- Changelog Generator €0.03
- Code Converter €0.05
- Commit Message Generator €0.05