scitex 2.14.0__py3-none-any.whl → 2.15.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scitex/__init__.py +71 -17
- scitex/_env_loader.py +156 -0
- scitex/_mcp_resources/__init__.py +37 -0
- scitex/_mcp_resources/_cheatsheet.py +135 -0
- scitex/_mcp_resources/_figrecipe.py +138 -0
- scitex/_mcp_resources/_formats.py +102 -0
- scitex/_mcp_resources/_modules.py +337 -0
- scitex/_mcp_resources/_session.py +149 -0
- scitex/_mcp_tools/__init__.py +4 -0
- scitex/_mcp_tools/audio.py +66 -0
- scitex/_mcp_tools/diagram.py +11 -95
- scitex/_mcp_tools/introspect.py +210 -0
- scitex/_mcp_tools/plt.py +260 -305
- scitex/_mcp_tools/scholar.py +74 -0
- scitex/_mcp_tools/social.py +244 -0
- scitex/_mcp_tools/template.py +24 -0
- scitex/_mcp_tools/writer.py +21 -204
- scitex/ai/_gen_ai/_PARAMS.py +10 -7
- scitex/ai/classification/reporters/_SingleClassificationReporter.py +45 -1603
- scitex/ai/classification/reporters/_mixins/__init__.py +36 -0
- scitex/ai/classification/reporters/_mixins/_constants.py +67 -0
- scitex/ai/classification/reporters/_mixins/_cv_summary.py +387 -0
- scitex/ai/classification/reporters/_mixins/_feature_importance.py +119 -0
- scitex/ai/classification/reporters/_mixins/_metrics.py +275 -0
- scitex/ai/classification/reporters/_mixins/_plotting.py +179 -0
- scitex/ai/classification/reporters/_mixins/_reports.py +153 -0
- scitex/ai/classification/reporters/_mixins/_storage.py +160 -0
- scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit.py +30 -1550
- scitex/ai/classification/timeseries/_sliding_window_core.py +467 -0
- scitex/ai/classification/timeseries/_sliding_window_plotting.py +369 -0
- scitex/audio/README.md +40 -36
- scitex/audio/__init__.py +129 -61
- scitex/audio/_branding.py +185 -0
- scitex/audio/_mcp/__init__.py +32 -0
- scitex/audio/_mcp/handlers.py +59 -6
- scitex/audio/_mcp/speak_handlers.py +238 -0
- scitex/audio/_relay.py +225 -0
- scitex/audio/_tts.py +18 -10
- scitex/audio/engines/base.py +17 -10
- scitex/audio/engines/elevenlabs_engine.py +7 -2
- scitex/audio/mcp_server.py +228 -75
- scitex/canvas/README.md +1 -1
- scitex/canvas/editor/_dearpygui/__init__.py +25 -0
- scitex/canvas/editor/_dearpygui/_editor.py +147 -0
- scitex/canvas/editor/_dearpygui/_handlers.py +476 -0
- scitex/canvas/editor/_dearpygui/_panels/__init__.py +17 -0
- scitex/canvas/editor/_dearpygui/_panels/_control.py +119 -0
- scitex/canvas/editor/_dearpygui/_panels/_element_controls.py +190 -0
- scitex/canvas/editor/_dearpygui/_panels/_preview.py +43 -0
- scitex/canvas/editor/_dearpygui/_panels/_sections.py +390 -0
- scitex/canvas/editor/_dearpygui/_plotting.py +187 -0
- scitex/canvas/editor/_dearpygui/_rendering.py +504 -0
- scitex/canvas/editor/_dearpygui/_selection.py +295 -0
- scitex/canvas/editor/_dearpygui/_state.py +93 -0
- scitex/canvas/editor/_dearpygui/_utils.py +61 -0
- scitex/canvas/editor/flask_editor/_core/__init__.py +27 -0
- scitex/canvas/editor/flask_editor/_core/_bbox_extraction.py +200 -0
- scitex/canvas/editor/flask_editor/_core/_editor.py +173 -0
- scitex/canvas/editor/flask_editor/_core/_export_helpers.py +353 -0
- scitex/canvas/editor/flask_editor/_core/_routes_basic.py +190 -0
- scitex/canvas/editor/flask_editor/_core/_routes_export.py +332 -0
- scitex/canvas/editor/flask_editor/_core/_routes_panels.py +252 -0
- scitex/canvas/editor/flask_editor/_core/_routes_save.py +218 -0
- scitex/canvas/editor/flask_editor/_core.py +25 -1684
- scitex/canvas/editor/flask_editor/templates/__init__.py +32 -70
- scitex/cli/__init__.py +38 -43
- scitex/cli/audio.py +76 -27
- scitex/cli/capture.py +13 -20
- scitex/cli/introspect.py +481 -0
- scitex/cli/main.py +200 -109
- scitex/cli/mcp.py +60 -34
- scitex/cli/plt.py +357 -0
- scitex/cli/repro.py +15 -8
- scitex/cli/resource.py +15 -8
- scitex/cli/scholar/__init__.py +23 -8
- scitex/cli/scholar/_crossref_scitex.py +296 -0
- scitex/cli/scholar/_fetch.py +25 -3
- scitex/cli/social.py +314 -0
- scitex/cli/stats.py +15 -8
- scitex/cli/template.py +129 -12
- scitex/cli/tex.py +15 -8
- scitex/cli/writer.py +132 -8
- scitex/cloud/__init__.py +41 -2
- scitex/config/README.md +1 -1
- scitex/config/__init__.py +16 -2
- scitex/config/_env_registry.py +256 -0
- scitex/context/__init__.py +22 -0
- scitex/dev/__init__.py +20 -1
- scitex/diagram/__init__.py +42 -19
- scitex/diagram/mcp_server.py +13 -125
- scitex/gen/__init__.py +50 -14
- scitex/gen/_list_packages.py +4 -4
- scitex/introspect/__init__.py +82 -0
- scitex/introspect/_call_graph.py +303 -0
- scitex/introspect/_class_hierarchy.py +163 -0
- scitex/introspect/_core.py +41 -0
- scitex/introspect/_docstring.py +131 -0
- scitex/introspect/_examples.py +113 -0
- scitex/introspect/_imports.py +271 -0
- scitex/{gen/_inspect_module.py → introspect/_list_api.py} +43 -54
- scitex/introspect/_mcp/__init__.py +41 -0
- scitex/introspect/_mcp/handlers.py +233 -0
- scitex/introspect/_members.py +155 -0
- scitex/introspect/_resolve.py +89 -0
- scitex/introspect/_signature.py +131 -0
- scitex/introspect/_source.py +80 -0
- scitex/introspect/_type_hints.py +172 -0
- scitex/io/_save.py +1 -2
- scitex/io/bundle/README.md +1 -1
- scitex/logging/_formatters.py +19 -9
- scitex/mcp_server.py +98 -5
- scitex/os/__init__.py +4 -0
- scitex/{gen → os}/_check_host.py +4 -5
- scitex/plt/__init__.py +245 -550
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/_wrappers.py +5 -10
- scitex/plt/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/plt/gallery/README.md +1 -1
- scitex/plt/utils/_hitmap/__init__.py +82 -0
- scitex/plt/utils/_hitmap/_artist_extraction.py +343 -0
- scitex/plt/utils/_hitmap/_color_application.py +346 -0
- scitex/plt/utils/_hitmap/_color_conversion.py +121 -0
- scitex/plt/utils/_hitmap/_constants.py +40 -0
- scitex/plt/utils/_hitmap/_hitmap_core.py +334 -0
- scitex/plt/utils/_hitmap/_path_extraction.py +357 -0
- scitex/plt/utils/_hitmap/_query.py +113 -0
- scitex/plt/utils/_hitmap.py +46 -1616
- scitex/plt/utils/_metadata/__init__.py +80 -0
- scitex/plt/utils/_metadata/_artists/__init__.py +25 -0
- scitex/plt/utils/_metadata/_artists/_base.py +195 -0
- scitex/plt/utils/_metadata/_artists/_collections.py +356 -0
- scitex/plt/utils/_metadata/_artists/_extract.py +57 -0
- scitex/plt/utils/_metadata/_artists/_images.py +80 -0
- scitex/plt/utils/_metadata/_artists/_lines.py +261 -0
- scitex/plt/utils/_metadata/_artists/_patches.py +247 -0
- scitex/plt/utils/_metadata/_artists/_text.py +106 -0
- scitex/plt/utils/_metadata/_csv.py +416 -0
- scitex/plt/utils/_metadata/_detect.py +225 -0
- scitex/plt/utils/_metadata/_legend.py +127 -0
- scitex/plt/utils/_metadata/_rounding.py +117 -0
- scitex/plt/utils/_metadata/_verification.py +202 -0
- scitex/schema/README.md +1 -1
- scitex/scholar/__init__.py +8 -0
- scitex/scholar/_mcp/crossref_handlers.py +265 -0
- scitex/scholar/core/Scholar.py +63 -1700
- scitex/scholar/core/_mixins/__init__.py +36 -0
- scitex/scholar/core/_mixins/_enrichers.py +270 -0
- scitex/scholar/core/_mixins/_library_handlers.py +100 -0
- scitex/scholar/core/_mixins/_loaders.py +103 -0
- scitex/scholar/core/_mixins/_pdf_download.py +375 -0
- scitex/scholar/core/_mixins/_pipeline.py +312 -0
- scitex/scholar/core/_mixins/_project_handlers.py +125 -0
- scitex/scholar/core/_mixins/_savers.py +69 -0
- scitex/scholar/core/_mixins/_search.py +103 -0
- scitex/scholar/core/_mixins/_services.py +88 -0
- scitex/scholar/core/_mixins/_url_finding.py +105 -0
- scitex/scholar/crossref_scitex.py +367 -0
- scitex/scholar/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/scholar/examples/00_run_all.sh +120 -0
- scitex/scholar/jobs/_executors.py +27 -3
- scitex/scholar/pdf_download/ScholarPDFDownloader.py +38 -416
- scitex/scholar/pdf_download/_cli.py +154 -0
- scitex/scholar/pdf_download/strategies/__init__.py +11 -8
- scitex/scholar/pdf_download/strategies/manual_download_fallback.py +80 -3
- scitex/scholar/pipelines/ScholarPipelineBibTeX.py +73 -121
- scitex/scholar/pipelines/ScholarPipelineParallel.py +80 -138
- scitex/scholar/pipelines/ScholarPipelineSingle.py +43 -63
- scitex/scholar/pipelines/_single_steps.py +71 -36
- scitex/scholar/storage/_LibraryManager.py +97 -1695
- scitex/scholar/storage/_mixins/__init__.py +30 -0
- scitex/scholar/storage/_mixins/_bibtex_handlers.py +128 -0
- scitex/scholar/storage/_mixins/_library_operations.py +218 -0
- scitex/scholar/storage/_mixins/_metadata_conversion.py +226 -0
- scitex/scholar/storage/_mixins/_paper_saving.py +456 -0
- scitex/scholar/storage/_mixins/_resolution.py +376 -0
- scitex/scholar/storage/_mixins/_storage_helpers.py +121 -0
- scitex/scholar/storage/_mixins/_symlink_handlers.py +226 -0
- scitex/scholar/url_finder/.tmp/open_url/KNOWN_RESOLVERS.py +462 -0
- scitex/scholar/url_finder/.tmp/open_url/README.md +223 -0
- scitex/scholar/url_finder/.tmp/open_url/_DOIToURLResolver.py +694 -0
- scitex/scholar/url_finder/.tmp/open_url/_OpenURLResolver.py +1160 -0
- scitex/scholar/url_finder/.tmp/open_url/_ResolverLinkFinder.py +344 -0
- scitex/scholar/url_finder/.tmp/open_url/__init__.py +24 -0
- scitex/security/README.md +3 -3
- scitex/session/README.md +1 -1
- scitex/session/__init__.py +26 -7
- scitex/session/_decorator.py +1 -1
- scitex/sh/README.md +1 -1
- scitex/sh/__init__.py +7 -4
- scitex/social/__init__.py +155 -0
- scitex/social/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/stats/_mcp/_handlers/__init__.py +31 -0
- scitex/stats/_mcp/_handlers/_corrections.py +113 -0
- scitex/stats/_mcp/_handlers/_descriptive.py +78 -0
- scitex/stats/_mcp/_handlers/_effect_size.py +106 -0
- scitex/stats/_mcp/_handlers/_format.py +94 -0
- scitex/stats/_mcp/_handlers/_normality.py +110 -0
- scitex/stats/_mcp/_handlers/_posthoc.py +224 -0
- scitex/stats/_mcp/_handlers/_power.py +247 -0
- scitex/stats/_mcp/_handlers/_recommend.py +102 -0
- scitex/stats/_mcp/_handlers/_run_test.py +279 -0
- scitex/stats/_mcp/_handlers/_stars.py +48 -0
- scitex/stats/_mcp/handlers.py +19 -1171
- scitex/stats/auto/_stat_style.py +175 -0
- scitex/stats/auto/_style_definitions.py +411 -0
- scitex/stats/auto/_styles.py +22 -620
- scitex/stats/descriptive/__init__.py +11 -8
- scitex/stats/descriptive/_ci.py +39 -0
- scitex/stats/power/_power.py +15 -4
- scitex/str/__init__.py +2 -1
- scitex/str/_title_case.py +63 -0
- scitex/template/README.md +1 -1
- scitex/template/__init__.py +25 -10
- scitex/template/_code_templates.py +147 -0
- scitex/template/_mcp/handlers.py +81 -0
- scitex/template/_mcp/tool_schemas.py +55 -0
- scitex/template/_templates/__init__.py +51 -0
- scitex/template/_templates/audio.py +233 -0
- scitex/template/_templates/canvas.py +312 -0
- scitex/template/_templates/capture.py +268 -0
- scitex/template/_templates/config.py +43 -0
- scitex/template/_templates/diagram.py +294 -0
- scitex/template/_templates/io.py +107 -0
- scitex/template/_templates/module.py +53 -0
- scitex/template/_templates/plt.py +202 -0
- scitex/template/_templates/scholar.py +267 -0
- scitex/template/_templates/session.py +130 -0
- scitex/template/_templates/session_minimal.py +43 -0
- scitex/template/_templates/session_plot.py +67 -0
- scitex/template/_templates/session_stats.py +77 -0
- scitex/template/_templates/stats.py +323 -0
- scitex/template/_templates/writer.py +296 -0
- scitex/template/clone_writer_directory.py +5 -5
- scitex/ui/_backends/_email.py +10 -2
- scitex/ui/_backends/_webhook.py +5 -1
- scitex/web/_search_pubmed.py +10 -6
- scitex/writer/README.md +1 -1
- scitex/writer/_mcp/handlers.py +11 -744
- scitex/writer/_mcp/tool_schemas.py +5 -335
- scitex-2.15.2.dist-info/METADATA +648 -0
- {scitex-2.14.0.dist-info → scitex-2.15.2.dist-info}/RECORD +246 -150
- scitex/canvas/editor/flask_editor/templates/_scripts.py +0 -4933
- scitex/canvas/editor/flask_editor/templates/_styles.py +0 -1658
- scitex/dev/plt/data/mpl/PLOTTING_FUNCTIONS.yaml +0 -90
- scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES.yaml +0 -1571
- scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES_DETAILED.yaml +0 -6262
- scitex/dev/plt/data/mpl/SIGNATURES_FLATTENED.yaml +0 -1274
- scitex/dev/plt/data/mpl/dir_ax.txt +0 -459
- scitex/diagram/_compile.py +0 -312
- scitex/diagram/_diagram.py +0 -355
- scitex/diagram/_mcp/__init__.py +0 -4
- scitex/diagram/_mcp/handlers.py +0 -400
- scitex/diagram/_mcp/tool_schemas.py +0 -157
- scitex/diagram/_presets.py +0 -173
- scitex/diagram/_schema.py +0 -182
- scitex/diagram/_split.py +0 -278
- scitex/gen/_ci.py +0 -12
- scitex/gen/_title_case.py +0 -89
- scitex/plt/_mcp/__init__.py +0 -4
- scitex/plt/_mcp/_handlers_annotation.py +0 -102
- scitex/plt/_mcp/_handlers_figure.py +0 -195
- scitex/plt/_mcp/_handlers_plot.py +0 -252
- scitex/plt/_mcp/_handlers_style.py +0 -219
- scitex/plt/_mcp/handlers.py +0 -74
- scitex/plt/_mcp/tool_schemas.py +0 -497
- scitex/plt/mcp_server.py +0 -231
- scitex/scholar/data/.gitkeep +0 -0
- scitex/scholar/data/README.md +0 -44
- scitex/scholar/data/bib_files/bibliography.bib +0 -1952
- scitex/scholar/data/bib_files/neurovista.bib +0 -277
- scitex/scholar/data/bib_files/neurovista_enriched.bib +0 -441
- scitex/scholar/data/bib_files/neurovista_enriched_enriched.bib +0 -441
- scitex/scholar/data/bib_files/neurovista_processed.bib +0 -338
- scitex/scholar/data/bib_files/openaccess.bib +0 -89
- scitex/scholar/data/bib_files/pac-seizure_prediction_enriched.bib +0 -2178
- scitex/scholar/data/bib_files/pac.bib +0 -698
- scitex/scholar/data/bib_files/pac_enriched.bib +0 -1061
- scitex/scholar/data/bib_files/pac_processed.bib +0 -0
- scitex/scholar/data/bib_files/pac_titles.txt +0 -75
- scitex/scholar/data/bib_files/paywalled.bib +0 -98
- scitex/scholar/data/bib_files/related-papers-by-coauthors.bib +0 -58
- scitex/scholar/data/bib_files/related-papers-by-coauthors_enriched.bib +0 -87
- scitex/scholar/data/bib_files/seizure_prediction.bib +0 -694
- scitex/scholar/data/bib_files/seizure_prediction_processed.bib +0 -0
- scitex/scholar/data/bib_files/test_complete_enriched.bib +0 -437
- scitex/scholar/data/bib_files/test_final_enriched.bib +0 -437
- scitex/scholar/data/bib_files/test_seizure.bib +0 -46
- scitex/scholar/data/impact_factor/JCR_IF_2022.xlsx +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024.db +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024.xlsx +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024_v01.db +0 -0
- scitex/scholar/data/impact_factor.db +0 -0
- scitex/scholar/examples/SUGGESTIONS.md +0 -865
- scitex/scholar/examples/dev.py +0 -38
- scitex-2.14.0.dist-info/METADATA +0 -1238
- /scitex/{gen → context}/_detect_environment.py +0 -0
- /scitex/{gen → context}/_get_notebook_path.py +0 -0
- /scitex/{gen/_shell.py → sh/_shell_legacy.py} +0 -0
- {scitex-2.14.0.dist-info → scitex-2.15.2.dist-info}/WHEEL +0 -0
- {scitex-2.14.0.dist-info → scitex-2.15.2.dist-info}/entry_points.txt +0 -0
- {scitex-2.14.0.dist-info → scitex-2.15.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Timestamp: 2026-01-20
|
|
3
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/_mcp_resources/_modules.py
|
|
4
|
+
"""Module-specific documentation resources for AI agents."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
__all__ = ["register_module_resources"]
|
|
9
|
+
|
|
10
|
+
MODULE_IO = """\
|
|
11
|
+
# stx.io - Universal File I/O
|
|
12
|
+
==============================
|
|
13
|
+
|
|
14
|
+
## Core API
|
|
15
|
+
```python
|
|
16
|
+
stx.io.save(obj, path, **kwargs) # Save any object
|
|
17
|
+
stx.io.load(path, **kwargs) # Load any file
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Key Features
|
|
21
|
+
|
|
22
|
+
### 1. Automatic Extension Handling
|
|
23
|
+
```python
|
|
24
|
+
stx.io.save(df, "data.csv") # Uses CSV handler
|
|
25
|
+
stx.io.save(df, "data.xlsx") # Uses Excel handler
|
|
26
|
+
stx.io.save(arr, "data.npy") # Uses NumPy handler
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Verbose Logging
|
|
30
|
+
```python
|
|
31
|
+
stx.io.save(df, "data.csv", verbose=True)
|
|
32
|
+
# Output: SUCC: Saved to: ./script_out/data.csv (12.5 KiB)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### 3. Metadata Embedding (Images)
|
|
36
|
+
```python
|
|
37
|
+
stx.io.save(fig, "plot.png", metadata={"exp": "exp01"})
|
|
38
|
+
img, meta = stx.io.load("plot.png")
|
|
39
|
+
print(meta) # {'exp': 'exp01', 'url': 'https://scitex.ai'}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 4. Symlink Creation
|
|
43
|
+
```python
|
|
44
|
+
stx.io.save(results, "results.csv", symlink_to="./data")
|
|
45
|
+
# Creates: ./data/results.csv -> ./script_out/results.csv
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 5. Auto CSV Export for Figures
|
|
49
|
+
```python
|
|
50
|
+
stx.io.save(fig, "plot.png")
|
|
51
|
+
# Creates BOTH: plot.png AND plot.csv (with plotted data)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Common Formats
|
|
55
|
+
- `.csv`, `.xlsx`, `.parquet` - DataFrames
|
|
56
|
+
- `.npy`, `.npz`, `.h5` - Arrays
|
|
57
|
+
- `.pkl`, `.json`, `.yaml` - Objects
|
|
58
|
+
- `.png`, `.jpg`, `.pdf`, `.svg` - Figures
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
MODULE_PLT = """\
|
|
62
|
+
# stx.plt - Publication-Ready Figures
|
|
63
|
+
======================================
|
|
64
|
+
|
|
65
|
+
## Basic Usage
|
|
66
|
+
```python
|
|
67
|
+
fig, ax = stx.plt.subplots()
|
|
68
|
+
|
|
69
|
+
# Use stx_ prefixed methods for auto CSV export
|
|
70
|
+
ax.stx_line(x, y, label="Signal")
|
|
71
|
+
ax.stx_scatter(x, y)
|
|
72
|
+
ax.stx_bar(categories, values)
|
|
73
|
+
ax.stx_errorbar(x, y, yerr=err)
|
|
74
|
+
|
|
75
|
+
# Set labels with convenience method
|
|
76
|
+
ax.set_xyt("X axis", "Y axis", "Title")
|
|
77
|
+
|
|
78
|
+
# Save -> creates BOTH image AND CSV
|
|
79
|
+
stx.io.save(fig, "plot.png")
|
|
80
|
+
fig.close()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Tracked Plot Methods (stx_ prefix)
|
|
84
|
+
```python
|
|
85
|
+
ax.stx_line(x, y) # Line plot
|
|
86
|
+
ax.stx_scatter(x, y) # Scatter plot
|
|
87
|
+
ax.stx_bar(x, height) # Bar chart
|
|
88
|
+
ax.stx_errorbar(x, y, yerr) # Error bars
|
|
89
|
+
ax.stx_hist(data, bins=30) # Histogram
|
|
90
|
+
ax.stx_boxplot(data) # Box plot
|
|
91
|
+
ax.stx_violinplot(data) # Violin plot
|
|
92
|
+
ax.stx_imshow(matrix) # Image/heatmap
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Auto CSV Export
|
|
96
|
+
When saving with `stx.io.save(fig, "plot.png")`, CSV is auto-created:
|
|
97
|
+
```csv
|
|
98
|
+
ax_00_stx_line_0_x,ax_00_stx_line_0_y
|
|
99
|
+
0.0,0.0
|
|
100
|
+
0.1,0.0998
|
|
101
|
+
...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Color Palette
|
|
105
|
+
```python
|
|
106
|
+
@stx.session
|
|
107
|
+
def main(COLORS=stx.INJECTED):
|
|
108
|
+
ax.stx_line(x, y1, color=COLORS.blue)
|
|
109
|
+
ax.stx_line(x, y2, color=COLORS.red)
|
|
110
|
+
# Available: blue, red, green, orange, purple, navy, pink, brown, gray
|
|
111
|
+
```
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
MODULE_STATS = """\
|
|
115
|
+
# stx.stats - Publication Statistics
|
|
116
|
+
=====================================
|
|
117
|
+
|
|
118
|
+
23 statistical tests with automatic assumption checking, effect sizes,
|
|
119
|
+
confidence intervals, and multiple output formats.
|
|
120
|
+
|
|
121
|
+
## Two-Sample Tests
|
|
122
|
+
```python
|
|
123
|
+
result = stx.stats.test_ttest_ind(group1, group2)
|
|
124
|
+
result = stx.stats.test_mannwhitneyu(group1, group2) # Non-parametric
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Paired Sample Tests
|
|
128
|
+
```python
|
|
129
|
+
result = stx.stats.test_ttest_rel(before, after)
|
|
130
|
+
result = stx.stats.test_wilcoxon(before, after)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Multiple Group Tests
|
|
134
|
+
```python
|
|
135
|
+
result = stx.stats.test_anova(g1, g2, g3, g4)
|
|
136
|
+
result = stx.stats.test_kruskal(g1, g2, g3, g4) # Non-parametric
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Correlation Tests
|
|
140
|
+
```python
|
|
141
|
+
result = stx.stats.test_pearsonr(x, y)
|
|
142
|
+
result = stx.stats.test_spearmanr(x, y)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Output Formats
|
|
146
|
+
```python
|
|
147
|
+
result = stx.stats.test_ttest_ind(g1, g2, return_as="dataframe") # Default
|
|
148
|
+
result = stx.stats.test_ttest_ind(g1, g2, return_as="latex") # Papers
|
|
149
|
+
result = stx.stats.test_ttest_ind(g1, g2, return_as="markdown") # Docs
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Result Contents
|
|
153
|
+
- `statistic`: Test statistic value
|
|
154
|
+
- `p_value`: P-value
|
|
155
|
+
- `effect_size`: Cohen's d, r, eta², etc.
|
|
156
|
+
- `ci_low`, `ci_high`: 95% CI
|
|
157
|
+
- `power`: Statistical power
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
MODULE_SCHOLAR = """\
|
|
161
|
+
# stx.scholar - Literature Management
|
|
162
|
+
======================================
|
|
163
|
+
|
|
164
|
+
BibTeX enrichment with abstracts for LLM context, DOI resolution,
|
|
165
|
+
PDF download, and impact factors.
|
|
166
|
+
|
|
167
|
+
## CLI Usage (Recommended)
|
|
168
|
+
```bash
|
|
169
|
+
scitex scholar bibtex papers.bib --project myresearch --num-workers 8
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## BibTeX Enrichment
|
|
173
|
+
|
|
174
|
+
Before:
|
|
175
|
+
```bibtex
|
|
176
|
+
@article{Smith2024,
|
|
177
|
+
title = {Neural Networks},
|
|
178
|
+
author = {Smith, John},
|
|
179
|
+
doi = {10.1038/s41586-024-00001-1}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
After:
|
|
184
|
+
```bibtex
|
|
185
|
+
@article{Smith2024,
|
|
186
|
+
title = {Neural Networks for Brain Signal Analysis},
|
|
187
|
+
author = {Smith, John and Lee, Alice},
|
|
188
|
+
doi = {10.1038/s41586-024-00001-1},
|
|
189
|
+
journal = {Nature},
|
|
190
|
+
year = {2024},
|
|
191
|
+
abstract = {We present a novel deep learning approach...},
|
|
192
|
+
impact_factor = {64.8}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The abstract provides rich context for LLM-based literature review!
|
|
197
|
+
|
|
198
|
+
## MCP Tools
|
|
199
|
+
- `scholar_search_papers`: Search papers
|
|
200
|
+
- `scholar_enrich_bibtex`: Add metadata
|
|
201
|
+
- `scholar_download_pdf`: Download PDFs
|
|
202
|
+
- `scholar_fetch_papers`: Async download
|
|
203
|
+
- `scholar_parse_pdf_content`: Extract text
|
|
204
|
+
|
|
205
|
+
## Tip: Get BibTeX from Scholar QA
|
|
206
|
+
1. Go to https://scholarqa.allen.ai/chat/
|
|
207
|
+
2. Ask research questions
|
|
208
|
+
3. Export All Citations -> Save as .bib
|
|
209
|
+
4. Enrich: `scitex scholar bibtex citations.bib`
|
|
210
|
+
"""
|
|
211
|
+
|
|
212
|
+
MODULE_SESSION = """\
|
|
213
|
+
# stx.session - Reproducible Experiment Tracking
|
|
214
|
+
=================================================
|
|
215
|
+
|
|
216
|
+
## The @stx.session Decorator
|
|
217
|
+
```python
|
|
218
|
+
@stx.session
|
|
219
|
+
def main(
|
|
220
|
+
input_file="data.csv", # CLI args (auto-generated)
|
|
221
|
+
n_epochs=100,
|
|
222
|
+
|
|
223
|
+
CONFIG=stx.INJECTED, # Session config
|
|
224
|
+
plt=stx.INJECTED, # matplotlib
|
|
225
|
+
COLORS=stx.INJECTED, # Color palette
|
|
226
|
+
rng=stx.INJECTED, # Random generator
|
|
227
|
+
logger=stx.INJECTED, # Logger
|
|
228
|
+
):
|
|
229
|
+
\"\"\"Docstring becomes --help.\"\"\"
|
|
230
|
+
stx.io.save(results, "output.csv", symlink_to="./data")
|
|
231
|
+
return 0
|
|
232
|
+
|
|
233
|
+
if __name__ == "__main__":
|
|
234
|
+
main()
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Injected Variables
|
|
238
|
+
|
|
239
|
+
### CONFIG (DotDict)
|
|
240
|
+
```python
|
|
241
|
+
CONFIG.ID # "2026Y-01M-20D-09h37m01s_boSr"
|
|
242
|
+
CONFIG.FILE # "/path/to/script.py"
|
|
243
|
+
CONFIG.SDIR_OUT # "/path/to/script_out"
|
|
244
|
+
CONFIG.SDIR_RUN # "/path/to/script_out/RUNNING/<session_id>"
|
|
245
|
+
CONFIG.PID # Process ID
|
|
246
|
+
CONFIG.ARGS # {"input_file": "data.csv", ...}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### COLORS
|
|
250
|
+
```python
|
|
251
|
+
COLORS.blue, COLORS.red, COLORS.green, COLORS.orange
|
|
252
|
+
COLORS.purple, COLORS.navy, COLORS.pink, COLORS.brown
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## YAML Config Loading
|
|
256
|
+
Place YAML files in `./config/` directory - auto-loaded into CONFIG:
|
|
257
|
+
```yaml
|
|
258
|
+
# ./config/experiment.yaml
|
|
259
|
+
model:
|
|
260
|
+
hidden_size: 256
|
|
261
|
+
num_layers: 3
|
|
262
|
+
training:
|
|
263
|
+
batch_size: 32
|
|
264
|
+
learning_rate: 0.001
|
|
265
|
+
```
|
|
266
|
+
Access via dot notation:
|
|
267
|
+
```python
|
|
268
|
+
CONFIG.experiment.model.hidden_size # 256
|
|
269
|
+
CONFIG.experiment.training.batch_size # 32
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Symlinks for Central Navigation
|
|
273
|
+
```python
|
|
274
|
+
stx.io.save(arr, "output.npy", symlink_to="./data")
|
|
275
|
+
# Creates: ./data/output.npy -> ../script_out/output.npy
|
|
276
|
+
```
|
|
277
|
+
Use `./data` to accumulate outputs from multiple scripts.
|
|
278
|
+
|
|
279
|
+
## Output Structure
|
|
280
|
+
```
|
|
281
|
+
script_out/
|
|
282
|
+
├── output.npy # Files at ROOT (not in session dir)
|
|
283
|
+
└── FINISHED_SUCCESS/
|
|
284
|
+
└── <session_id>/
|
|
285
|
+
├── CONFIGS/
|
|
286
|
+
│ ├── CONFIG.pkl # Pickle snapshot
|
|
287
|
+
│ └── CONFIG.yaml # Human-readable
|
|
288
|
+
└── logs/
|
|
289
|
+
├── stdout.log # print() captured
|
|
290
|
+
└── stderr.log # errors captured
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Best Practices
|
|
294
|
+
1. Always return exit status (0 for success)
|
|
295
|
+
2. Use stx.io.save() with symlink_to="./data"
|
|
296
|
+
3. Use stx.plt for figures (auto CSV export)
|
|
297
|
+
"""
|
|
298
|
+
|
|
299
|
+
MODULE_DOCS = {
|
|
300
|
+
"io": MODULE_IO,
|
|
301
|
+
"plt": MODULE_PLT,
|
|
302
|
+
"stats": MODULE_STATS,
|
|
303
|
+
"scholar": MODULE_SCHOLAR,
|
|
304
|
+
"session": MODULE_SESSION,
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def register_module_resources(mcp) -> None:
|
|
309
|
+
"""Register module documentation resources."""
|
|
310
|
+
|
|
311
|
+
@mcp.resource("scitex://module/io")
|
|
312
|
+
def module_io() -> str:
|
|
313
|
+
"""stx.io module documentation - Universal File I/O."""
|
|
314
|
+
return MODULE_DOCS["io"]
|
|
315
|
+
|
|
316
|
+
@mcp.resource("scitex://module/plt")
|
|
317
|
+
def module_plt() -> str:
|
|
318
|
+
"""stx.plt module documentation - Publication-ready figures."""
|
|
319
|
+
return MODULE_DOCS["plt"]
|
|
320
|
+
|
|
321
|
+
@mcp.resource("scitex://module/stats")
|
|
322
|
+
def module_stats() -> str:
|
|
323
|
+
"""stx.stats module documentation - Statistical tests."""
|
|
324
|
+
return MODULE_DOCS["stats"]
|
|
325
|
+
|
|
326
|
+
@mcp.resource("scitex://module/scholar")
|
|
327
|
+
def module_scholar() -> str:
|
|
328
|
+
"""stx.scholar module documentation - Literature management."""
|
|
329
|
+
return MODULE_DOCS["scholar"]
|
|
330
|
+
|
|
331
|
+
@mcp.resource("scitex://module/session")
|
|
332
|
+
def module_session() -> str:
|
|
333
|
+
"""stx.session module documentation - Experiment tracking."""
|
|
334
|
+
return MODULE_DOCS["session"]
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
# EOF
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Timestamp: 2026-01-20
|
|
3
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/_mcp_resources/_session.py
|
|
4
|
+
"""Session output tree documentation resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
__all__ = ["register_session_resources"]
|
|
9
|
+
|
|
10
|
+
SESSION_TREE = """\
|
|
11
|
+
# @stx.session Output Directory Structure
|
|
12
|
+
==========================================
|
|
13
|
+
|
|
14
|
+
When you use @stx.session, outputs are automatically organized:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
script.py # Your script
|
|
18
|
+
script_out/ # Output directory (auto-created)
|
|
19
|
+
├── output.npy # Your saved files (ROOT level)
|
|
20
|
+
├── results.json # All outputs here, NOT in session dir
|
|
21
|
+
├── figure.png # Figures
|
|
22
|
+
├── figure.csv # Auto-exported plot data
|
|
23
|
+
├── RUNNING/ # Currently running sessions
|
|
24
|
+
│ └── 2025Y-01M-20D-09h30m00s_AbC1-main/
|
|
25
|
+
│ ├── CONFIGS/
|
|
26
|
+
│ │ ├── CONFIG.pkl # Python config object (pickle)
|
|
27
|
+
│ │ └── CONFIG.yaml # Human-readable config snapshot
|
|
28
|
+
│ └── logs/
|
|
29
|
+
│ ├── stdout.log # All print() output captured
|
|
30
|
+
│ └── stderr.log # All errors captured
|
|
31
|
+
├── FINISHED_SUCCESS/ # Completed sessions (moved from RUNNING)
|
|
32
|
+
│ └── <session_id>-main/
|
|
33
|
+
│ ├── CONFIGS/...
|
|
34
|
+
│ └── logs/...
|
|
35
|
+
└── FINISHED_FAILED/ # Failed sessions (errors)
|
|
36
|
+
└── <session_id>-main/
|
|
37
|
+
└── ...
|
|
38
|
+
data/ # Central navigation via symlinks
|
|
39
|
+
└── output.npy -> ../script_out/output.npy
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Key Points
|
|
43
|
+
|
|
44
|
+
1. **Session ID Format**: `YYYY'Y'-MM'M'-DD'D'-HH'h'MM'm'SS's'_XXXX-funcname`
|
|
45
|
+
- Example: `2026Y-01M-20D-09h37m01s_boSr-main`
|
|
46
|
+
|
|
47
|
+
2. **Output File Placement**:
|
|
48
|
+
- Files saved with `stx.io.save(obj, "filename")` go to `script_out/` ROOT
|
|
49
|
+
- NOT inside the session subdirectory (CONFIGS/logs only there)
|
|
50
|
+
|
|
51
|
+
3. **Symlinks for Central Navigation**:
|
|
52
|
+
```python
|
|
53
|
+
stx.io.save(arr, "output.npy", symlink_to="./data")
|
|
54
|
+
# Creates: ./data/output.npy -> ../script_out/output.npy
|
|
55
|
+
```
|
|
56
|
+
- Use `./data` directory to accumulate outputs from multiple scripts
|
|
57
|
+
- Easy navigation without digging into individual script_out directories
|
|
58
|
+
|
|
59
|
+
4. **CONFIG Object** (available as `CONFIG=stx.INJECTED`):
|
|
60
|
+
```python
|
|
61
|
+
CONFIG.ID # "2026Y-01M-20D-09h37m01s_boSr"
|
|
62
|
+
CONFIG.FILE # "/path/to/script.py"
|
|
63
|
+
CONFIG.SDIR_OUT # "/path/to/script_out"
|
|
64
|
+
CONFIG.SDIR_RUN # "/path/to/script_out/RUNNING/<session_id>"
|
|
65
|
+
CONFIG.PID # 12345
|
|
66
|
+
CONFIG.ARGS # {"n_points": 100, ...}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
5. **YAML Config Loading** (from `./config/*.yaml`):
|
|
70
|
+
```yaml
|
|
71
|
+
# ./config/experiment.yaml
|
|
72
|
+
model:
|
|
73
|
+
hidden_size: 256
|
|
74
|
+
num_layers: 3
|
|
75
|
+
training:
|
|
76
|
+
batch_size: 32
|
|
77
|
+
```
|
|
78
|
+
Access: `CONFIG.experiment.model.hidden_size # 256`
|
|
79
|
+
|
|
80
|
+
6. **Automatic Cleanup**:
|
|
81
|
+
- On success: RUNNING -> FINISHED_SUCCESS
|
|
82
|
+
- On error: RUNNING -> FINISHED_FAILED
|
|
83
|
+
- All print()/stderr captured in logs/
|
|
84
|
+
|
|
85
|
+
## Example Script
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
#!/usr/bin/env python3
|
|
89
|
+
import scitex as stx
|
|
90
|
+
import numpy as np
|
|
91
|
+
|
|
92
|
+
@stx.session
|
|
93
|
+
def main(n_points=100, CONFIG=stx.INJECTED, plt=stx.INJECTED):
|
|
94
|
+
\"\"\"Generate sample data and plot.\"\"\"
|
|
95
|
+
|
|
96
|
+
x = np.linspace(0, 10, n_points)
|
|
97
|
+
y = np.sin(x) * np.exp(-x/5)
|
|
98
|
+
|
|
99
|
+
fig, ax = stx.plt.subplots()
|
|
100
|
+
ax.stx_line(x, y)
|
|
101
|
+
ax.set_xyt("X", "Y", "Damped Sine")
|
|
102
|
+
|
|
103
|
+
# symlink_to for central navigation
|
|
104
|
+
stx.io.save(fig, "sine.png", symlink_to="./data")
|
|
105
|
+
fig.close()
|
|
106
|
+
|
|
107
|
+
return 0
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
main()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Output:
|
|
114
|
+
```
|
|
115
|
+
SUCC: Saved to: ./script_out/sine.png (241.6 KiB)
|
|
116
|
+
SUCC: Symlinked: /path/script_out/sine.png ->
|
|
117
|
+
SUCC: /path/data/sine.png
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Tree after running:
|
|
121
|
+
```
|
|
122
|
+
script.py
|
|
123
|
+
script_out/
|
|
124
|
+
├── sine.png # Figure at ROOT level
|
|
125
|
+
├── sine.csv # Auto-exported data
|
|
126
|
+
└── FINISHED_SUCCESS/
|
|
127
|
+
└── 2026Y-01M-20D-09h37m01s_boSr-main/
|
|
128
|
+
├── CONFIGS/
|
|
129
|
+
│ ├── CONFIG.pkl
|
|
130
|
+
│ └── CONFIG.yaml
|
|
131
|
+
└── logs/
|
|
132
|
+
├── stdout.log
|
|
133
|
+
└── stderr.log
|
|
134
|
+
data/
|
|
135
|
+
└── sine.png -> ../script_out/sine.png
|
|
136
|
+
```
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def register_session_resources(mcp) -> None:
|
|
141
|
+
"""Register session tree resource."""
|
|
142
|
+
|
|
143
|
+
@mcp.resource("scitex://session-tree")
|
|
144
|
+
def session_tree() -> str:
|
|
145
|
+
"""Explain the @stx.session output directory structure."""
|
|
146
|
+
return SESSION_TREE
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# EOF
|
scitex/_mcp_tools/__init__.py
CHANGED
|
@@ -9,8 +9,10 @@ from .audio import register_audio_tools
|
|
|
9
9
|
from .canvas import register_canvas_tools
|
|
10
10
|
from .capture import register_capture_tools
|
|
11
11
|
from .diagram import register_diagram_tools
|
|
12
|
+
from .introspect import register_introspect_tools
|
|
12
13
|
from .plt import register_plt_tools
|
|
13
14
|
from .scholar import register_scholar_tools
|
|
15
|
+
from .social import register_social_tools
|
|
14
16
|
from .stats import register_stats_tools
|
|
15
17
|
from .template import register_template_tools
|
|
16
18
|
from .ui import register_ui_tools
|
|
@@ -25,8 +27,10 @@ def register_all_tools(mcp) -> None:
|
|
|
25
27
|
register_canvas_tools(mcp)
|
|
26
28
|
register_capture_tools(mcp)
|
|
27
29
|
register_diagram_tools(mcp)
|
|
30
|
+
register_introspect_tools(mcp)
|
|
28
31
|
register_plt_tools(mcp)
|
|
29
32
|
register_scholar_tools(mcp)
|
|
33
|
+
register_social_tools(mcp)
|
|
30
34
|
register_stats_tools(mcp)
|
|
31
35
|
register_template_tools(mcp)
|
|
32
36
|
register_ui_tools(mcp)
|
scitex/_mcp_tools/audio.py
CHANGED
|
@@ -28,6 +28,7 @@ def register_audio_tools(mcp) -> None:
|
|
|
28
28
|
fallback: bool = True,
|
|
29
29
|
agent_id: Optional[str] = None,
|
|
30
30
|
wait: bool = True,
|
|
31
|
+
signature: bool = False,
|
|
31
32
|
) -> str:
|
|
32
33
|
"""[audio] Convert text to speech with fallback (pyttsx3 -> gtts -> elevenlabs)."""
|
|
33
34
|
from scitex.audio._mcp.handlers import speak_handler
|
|
@@ -43,6 +44,7 @@ def register_audio_tools(mcp) -> None:
|
|
|
43
44
|
fallback=fallback,
|
|
44
45
|
agent_id=agent_id,
|
|
45
46
|
wait=wait,
|
|
47
|
+
signature=signature,
|
|
46
48
|
)
|
|
47
49
|
return _json(result)
|
|
48
50
|
|
|
@@ -130,5 +132,69 @@ def register_audio_tools(mcp) -> None:
|
|
|
130
132
|
result = await announce_context_handler(include_full_path=include_full_path)
|
|
131
133
|
return _json(result)
|
|
132
134
|
|
|
135
|
+
@mcp.tool()
|
|
136
|
+
async def audio_speak_local(
|
|
137
|
+
text: str,
|
|
138
|
+
backend: Optional[str] = None,
|
|
139
|
+
voice: Optional[str] = None,
|
|
140
|
+
rate: int = 150,
|
|
141
|
+
speed: float = 1.5,
|
|
142
|
+
play: bool = True,
|
|
143
|
+
save: bool = False,
|
|
144
|
+
fallback: bool = True,
|
|
145
|
+
agent_id: Optional[str] = None,
|
|
146
|
+
) -> str:
|
|
147
|
+
"""[audio] Convert text to speech on the LOCAL/SERVER machine.
|
|
148
|
+
|
|
149
|
+
Use when running Claude Code directly on your local machine.
|
|
150
|
+
Audio plays where MCP server runs.
|
|
151
|
+
"""
|
|
152
|
+
from scitex.audio._mcp.speak_handlers import speak_local_handler
|
|
153
|
+
|
|
154
|
+
result = await speak_local_handler(
|
|
155
|
+
text=text,
|
|
156
|
+
backend=backend,
|
|
157
|
+
voice=voice,
|
|
158
|
+
rate=rate,
|
|
159
|
+
speed=speed,
|
|
160
|
+
play=play,
|
|
161
|
+
save=save,
|
|
162
|
+
fallback=fallback,
|
|
163
|
+
agent_id=agent_id,
|
|
164
|
+
)
|
|
165
|
+
return _json(result)
|
|
166
|
+
|
|
167
|
+
@mcp.tool()
|
|
168
|
+
async def audio_speak_relay(
|
|
169
|
+
text: str,
|
|
170
|
+
backend: Optional[str] = None,
|
|
171
|
+
voice: Optional[str] = None,
|
|
172
|
+
rate: int = 150,
|
|
173
|
+
speed: float = 1.5,
|
|
174
|
+
play: bool = True,
|
|
175
|
+
save: bool = False,
|
|
176
|
+
fallback: bool = True,
|
|
177
|
+
agent_id: Optional[str] = None,
|
|
178
|
+
) -> str:
|
|
179
|
+
"""[audio] Convert text to speech via RELAY server (remote playback).
|
|
180
|
+
|
|
181
|
+
Use when running on remote server (NAS) and want audio on your
|
|
182
|
+
local machine. Returns error with setup instructions if unavailable.
|
|
183
|
+
"""
|
|
184
|
+
from scitex.audio._mcp.speak_handlers import speak_relay_handler
|
|
185
|
+
|
|
186
|
+
result = await speak_relay_handler(
|
|
187
|
+
text=text,
|
|
188
|
+
backend=backend,
|
|
189
|
+
voice=voice,
|
|
190
|
+
rate=rate,
|
|
191
|
+
speed=speed,
|
|
192
|
+
play=play,
|
|
193
|
+
save=save,
|
|
194
|
+
fallback=fallback,
|
|
195
|
+
agent_id=agent_id,
|
|
196
|
+
)
|
|
197
|
+
return _json(result)
|
|
198
|
+
|
|
133
199
|
|
|
134
200
|
# EOF
|
scitex/_mcp_tools/diagram.py
CHANGED
|
@@ -1,106 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
|
-
# Timestamp: 2026-01-
|
|
2
|
+
# Timestamp: 2026-01-24
|
|
3
3
|
# File: /home/ywatanabe/proj/scitex-code/src/scitex/_mcp_tools/diagram.py
|
|
4
|
-
"""Diagram module tools for FastMCP unified server.
|
|
5
|
-
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
|
|
8
|
-
import json
|
|
9
|
-
from typing import Optional
|
|
4
|
+
"""Diagram module tools for FastMCP unified server.
|
|
10
5
|
|
|
6
|
+
Delegates entirely to figrecipe's diagram MCP tools.
|
|
7
|
+
figrecipe is the single source of truth.
|
|
8
|
+
"""
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
return json.dumps(data, indent=2, default=str)
|
|
10
|
+
from __future__ import annotations
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
def register_diagram_tools(mcp) -> None:
|
|
17
|
-
"""Register diagram tools
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
spec_path: Optional[str] = None,
|
|
22
|
-
spec_dict: Optional[dict] = None,
|
|
23
|
-
) -> str:
|
|
24
|
-
"""[diagram] Create a diagram from a YAML specification file or dictionary."""
|
|
25
|
-
from scitex.diagram._mcp.handlers import create_diagram_handler
|
|
26
|
-
|
|
27
|
-
result = await create_diagram_handler(
|
|
28
|
-
spec_path=spec_path,
|
|
29
|
-
spec_dict=spec_dict,
|
|
30
|
-
)
|
|
31
|
-
return _json(result)
|
|
32
|
-
|
|
33
|
-
@mcp.tool()
|
|
34
|
-
async def diagram_compile_mermaid(
|
|
35
|
-
spec_path: Optional[str] = None,
|
|
36
|
-
output_path: Optional[str] = None,
|
|
37
|
-
spec_dict: Optional[dict] = None,
|
|
38
|
-
) -> str:
|
|
39
|
-
"""[diagram] Compile diagram specification to Mermaid format."""
|
|
40
|
-
from scitex.diagram._mcp.handlers import compile_mermaid_handler
|
|
41
|
-
|
|
42
|
-
result = await compile_mermaid_handler(
|
|
43
|
-
spec_path=spec_path,
|
|
44
|
-
output_path=output_path,
|
|
45
|
-
spec_dict=spec_dict,
|
|
46
|
-
)
|
|
47
|
-
return _json(result)
|
|
48
|
-
|
|
49
|
-
@mcp.tool()
|
|
50
|
-
async def diagram_compile_graphviz(
|
|
51
|
-
spec_path: Optional[str] = None,
|
|
52
|
-
output_path: Optional[str] = None,
|
|
53
|
-
spec_dict: Optional[dict] = None,
|
|
54
|
-
) -> str:
|
|
55
|
-
"""[diagram] Compile diagram specification to Graphviz DOT format."""
|
|
56
|
-
from scitex.diagram._mcp.handlers import compile_graphviz_handler
|
|
57
|
-
|
|
58
|
-
result = await compile_graphviz_handler(
|
|
59
|
-
spec_path=spec_path,
|
|
60
|
-
output_path=output_path,
|
|
61
|
-
spec_dict=spec_dict,
|
|
62
|
-
)
|
|
63
|
-
return _json(result)
|
|
64
|
-
|
|
65
|
-
@mcp.tool()
|
|
66
|
-
async def diagram_list_presets() -> str:
|
|
67
|
-
"""[diagram] List available diagram presets (workflow, decision, pipeline)."""
|
|
68
|
-
from scitex.diagram._mcp.handlers import list_presets_handler
|
|
69
|
-
|
|
70
|
-
result = await list_presets_handler()
|
|
71
|
-
return _json(result)
|
|
72
|
-
|
|
73
|
-
@mcp.tool()
|
|
74
|
-
async def diagram_get_preset(preset_name: str) -> str:
|
|
75
|
-
"""[diagram] Get a diagram preset configuration by name."""
|
|
76
|
-
from scitex.diagram._mcp.handlers import get_preset_handler
|
|
77
|
-
|
|
78
|
-
result = await get_preset_handler(preset_name=preset_name)
|
|
79
|
-
return _json(result)
|
|
80
|
-
|
|
81
|
-
@mcp.tool()
|
|
82
|
-
async def diagram_split_diagram(
|
|
83
|
-
spec_path: str,
|
|
84
|
-
strategy: str = "horizontal",
|
|
85
|
-
max_nodes_per_part: int = 10,
|
|
86
|
-
) -> str:
|
|
87
|
-
"""[diagram] Split a large diagram into smaller parts for multi-column layouts."""
|
|
88
|
-
from scitex.diagram._mcp.handlers import split_diagram_handler
|
|
89
|
-
|
|
90
|
-
result = await split_diagram_handler(
|
|
91
|
-
spec_path=spec_path,
|
|
92
|
-
strategy=strategy,
|
|
93
|
-
max_nodes_per_part=max_nodes_per_part,
|
|
94
|
-
)
|
|
95
|
-
return _json(result)
|
|
96
|
-
|
|
97
|
-
@mcp.tool()
|
|
98
|
-
async def diagram_get_paper_modes() -> str:
|
|
99
|
-
"""[diagram] Get available paper layout modes and their constraints."""
|
|
100
|
-
from scitex.diagram._mcp.handlers import get_paper_modes_handler
|
|
14
|
+
"""Register diagram tools by delegating to figrecipe."""
|
|
15
|
+
from figrecipe._mcp._diagram_tools import (
|
|
16
|
+
register_diagram_tools as register_figrecipe_diagram_tools,
|
|
17
|
+
)
|
|
101
18
|
|
|
102
|
-
|
|
103
|
-
return _json(result)
|
|
19
|
+
register_figrecipe_diagram_tools(mcp)
|
|
104
20
|
|
|
105
21
|
|
|
106
22
|
# EOF
|