MCPcopy
hub / github.com/ComposioHQ/composio / generate_index_mdx

Function generate_index_mdx

python/scripts/generate-docs.py:480–566  ·  view source on GitHub ↗

Generate index page.

(classes: list[dict], decorators: list[dict])

Source from the content-addressed store, hash-verified

478
479
480def generate_index_mdx(classes: list[dict], decorators: list[dict]) -> str:
481 """Generate index page."""
482
483 # Classes table
484 class_rows = []
485 for c in classes:
486 link = f"/reference/sdk-reference/python/{slug_for(c['name'])}"
487 desc = (
488 c["description"][:80] + "..."
489 if len(c["description"]) > 80
490 else c["description"]
491 )
492 class_rows.append(f"| [`{display_name_for(c['name'])}`]({link}) | {desc} |")
493
494 # Decorators section
495 dec_section = ""
496 if decorators:
497 dec_lines = ["## Decorators", ""]
498 for d in decorators:
499 dec_lines.append(f"### {d['name']}")
500 dec_lines.append("")
501 if d["description"]:
502 dec_lines.append(d["description"])
503 dec_lines.append("")
504 if d["source_link"]:
505 dec_lines.append(f"[View source]({d['source_link']})")
506 dec_lines.append("")
507 # Signature
508 params = ", ".join(
509 f"{p['name']}: {p['type']}" + (" = ..." if p["optional"] else "")
510 for p in d["parameters"]
511 )
512 dec_lines.append("```python")
513 dec_lines.append(f"@{d['name']}({params})")
514 dec_lines.append("def my_modifier(...):")
515 dec_lines.append(" ...")
516 dec_lines.append("```")
517 dec_lines.append("")
518 dec_section = "\n".join(dec_lines)
519
520 return f"""---
521title: {escape_yaml_string("Python SDK Reference")}
522description: {escape_yaml_string("API reference for the Composio Python SDK")}
523---
524
525# Python SDK Reference
526
527Complete API reference for the `composio` Python package.
528
529## Installation
530
531```bash
532pip install composio
533```
534
535Or with uv:
536
537```bash

Callers 1

mainFunction · 0.85

Calls 4

slug_forFunction · 0.85
display_name_forFunction · 0.85
escape_yaml_stringFunction · 0.85
appendMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…