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

FieldTypeRequiredWhat it is
codestringYes—
stylestringNogoogle/numpy/sphinx

Output fields

How reliably each field appears in a successful answer.

FieldTypeAppears
stylestringAlways (present in every successful answer)
documented_codestringAlways (present in every successful answer)
functions_documentedintegerAlways (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
  }'

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