Categories

Docstring Extractor

Extract and parse documentation from JavaScript/TypeScript, Python, and Java source code

Features

Extract documentation from multiple programming languages:

  • JSDoc: JavaScript and TypeScript documentation comments
  • Python Docstrings: Triple-quoted function and class documentation
  • JavaDoc: Java documentation comments with standard tags

Extraction

Extracts complete documentation metadata:

  • Function/Class names: Symbol identifiers
  • Descriptions: Main documentation text
  • Parameters: @param tags with names, types, and descriptions
  • Return values: @return or @returns tags
  • Exceptions: @throws, @exception, or raises sections
  • Examples: @example tags or example code blocks
  • Line numbers: Location in source code
  • Visibility: Public, private, or protected members

Parsing

Parses common documentation patterns:

  • JSDoc: /** ... */ with @param, @return, @throws
  • Python: """...""" with Args, Returns, Raises sections
  • JavaDoc: /** ... */ with @param, @return, @throws

Index

Generates searchable documentation index:

  • Symbol names for quick lookup
  • Type categorization (functions, classes, methods)
  • Documentation completeness metrics
  • Examples, parameters, and return type counts

Include complete original documentation comments

Key Facts

Category
Development
Input Types
textarea, select, checkbox
Output Type
json
Sample Coverage
4
API Ready
Yes

Overview

The Docstring Extractor is a tool that automatically extracts and parses documentation comments from source code in JavaScript, TypeScript, Python, and Java. It supports JSDoc, Python docstrings, and JavaDoc formats, outputting structured JSON with metadata like function names, parameters, and return types for easy integration into documentation workflows.

When to Use

  • When generating API documentation from source code comments.
  • When auditing codebases to check for documentation completeness and consistency.
  • When migrating or standardizing documentation across different programming languages.

How It Works

  • Paste your source code into the input field or upload a file.
  • Select the programming language manually or use auto-detect for mixed code.
  • Optionally enable 'Include Full Documentation Text' to retain original comments.
  • Click extract to parse the documentation and receive a JSON output with extracted metadata.

Use Cases

Building interactive API documentation websites from extracted comments.
Performing code reviews to ensure functions are properly documented with parameters and return types.
Extracting documentation for use in IDEs or static analysis tools to improve developer productivity.

Examples

1. Extract JSDoc from a JavaScript Module

Frontend Developer
Background
A developer has a JavaScript file with JSDoc comments describing functions for a web application.
Problem
Manually copying documentation for API reference is tedious and prone to errors.
How to Use
Paste the JavaScript code into the tool and select 'JavaScript' as the language hint.
Outcome
A JSON object with extracted function names, @param tags, @return descriptions, and line numbers for quick reference.

2. Parse Python Docstrings for Backend API

Background
A Python project contains functions with triple-quoted docstrings outlining Args, Returns, and Raises sections.
Problem
Need to generate a structured API reference without manually parsing each docstring.
How to Use
Input the Python source code and let the tool auto-detect the language to extract documentation.
Outcome
JSON output with parsed parameters, return types, and exception details, ready for documentation generation.

3. Analyze JavaDoc in Java Classes

Background
A Java codebase has classes with JavaDoc comments that include @param, @return, and @throws tags.
Problem
Assessing documentation coverage across methods to identify gaps in the project.
How to Use
Upload the Java source files and extract metadata to review documented symbols.
Outcome
Insights into documented methods, parameters, and exceptions, with visibility and completeness metrics in JSON format.

Try with Samples

text

Related Hubs

FAQ

What programming languages are supported?

JavaScript, TypeScript, Python, and Java.

What types of documentation comments does it extract?

JSDoc for JavaScript/TypeScript, triple-quoted docstrings for Python, and JavaDoc for Java.

Can it handle code with multiple languages?

Yes, use auto-detect or specify the language hint for accurate parsing.

What information is included in the JSON output?

Function/class names, descriptions, parameters, return values, exceptions, examples, line numbers, and visibility.

Is the output customizable?

You can choose to include the full original documentation text via a checkbox option.

API Documentation

Request Endpoint

POST /en/api/tools/docstring-extractor

Request Parameters

Parameter Name Type Required Description
codeInput textarea Yes -
languageHint select No -
includeFullText checkbox No Include complete original documentation comments

Response Format

{
  "key": {...},
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
JSON Data: JSON Data

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-docstring-extractor": {
      "name": "docstring-extractor",
      "description": "Extract and parse documentation from JavaScript/TypeScript, Python, and Java source code",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=docstring-extractor",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]