-
Notifications
You must be signed in to change notification settings - Fork 171
docs(examples): mcp generated notebooks #256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request adds a README for MCP example notebooks and six Deepnote notebook templates (A/B test evaluator, API analytics client, churn prediction, ETL pipeline, financial analytics, SaaS metrics dashboard). Each notebook contains structured sections, placeholder code, visualizations, and interactive inputs. Additionally, input widgets in the MCP tooling were augmented with explicit `deepnote_variable_value` defaults across scaffold/template/enhance constructs. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## mcp-skills #256 +/- ##
===========================================
Coverage 72.37% 72.37%
===========================================
Files 93 93
Lines 6393 6393
Branches 1838 1783 -55
===========================================
Hits 4627 4627
Misses 1766 1766 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
🤖 Fix all issues with AI agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote`:
- Around line 54-59: The cell assumes the DataFrame variable df exists; add a
guard that checks whether df is defined and not None before accessing its
attributes (e.g., using "if 'df' in locals() or 'df' in globals()" or a
try/except NameError) and, if not present, print a short message like "DataFrame
df not loaded — please run the data loading cell" so the cell doesn't raise a
NameError; update the block containing the print(df.shape), print(df.dtypes),
and print(df.isnull().sum()) to perform this presence check first.
- Around line 15-19: The markdown description (id:
7f0d0401-2bcd-4207-b0e2-db32e29a557b, type: markdown) is missing a verb; update
the sentence "This notebook A/B test statistical analysis tool that takes
experiment data..." to a grammatically correct form such as "This notebook is an
A/B test statistical analysis tool that takes experiment data..." (or "This
notebook provides an A/B test statistical analysis tool..."), ensuring the rest
of the description remains unchanged.
In `@examples/mcp-demos/api_analytics_client.deepnote`:
- Around line 42-51: The notebook currently stores the API key in an input-text
block (deepnote_variable_name: api_key / deepnote_input_label: API Key) which is
not masked; remove this input block and instead configure the API key as an
encrypted Environment Variable via Integrations → Environment variables, then
update any code that references the variable to read it from the environment
(e.g., use os.environ["MY_API_KEY"] or the equivalent in your runtime) and
ensure all references to "api_key" are replaced with the environment lookup.
In `@examples/mcp-demos/churn_prediction.deepnote`:
- Around line 21-22: The markdown sentence describing the notebook is missing a
verb and reads awkwardly; update the content string (the markdown block with
"This notebook Customer churn prediction model...") to include a verb and
improve clarity — e.g., "This notebook implements a customer churn prediction
model that loads customer data, performs feature engineering on usage metrics,
subscription history, and engagement data, trains a classification model with
hyperparameter tuning, evaluates model performance with a confusion matrix and
ROC curve, and outputs churn probability scores." Replace the existing content
text accordingly.
- Around line 124-136: The snippet uses the symbol plt when plotting but never
imports matplotlib; add an import for matplotlib.pyplot (e.g., import
matplotlib.pyplot as plt) before any use of plt (place it alongside the other
imports at the top of the cell/script where y_pred = model.predict(...) and
confusion_matrix are used) so that plt is defined when calling plt.figure and
subsequent plotting calls.
In `@examples/mcp-demos/etl_data_pipeline.deepnote`:
- Around line 192-199: The current validate_output block only logs validation
issues returned by validate_data(df_transformed) but does not prevent the
subsequent Load step from writing invalid data; change the flow so that when
validate_output is True and validate_data(...) returns any issues you either
raise a ValidationError (or RuntimeError) with the issue details or set/return a
flag to abort the Load step, ensuring the code that performs the load (the
downstream write/load routine) checks this flag or catches the exception and
stops writing; update validate_data usage and callers so failures short-circuit
the pipeline (e.g., replace the print-only branch with a raise or return False
that the load function respects).
In `@examples/mcp-demos/README.md`:
- Line 11: The CI spellcheck flags the brand name "Slido" in the table row for
"SaaS Metrics Dashboard"; fix by adding a cspell ignore or dictionary entry for
"Slido" (e.g., add "Slido" to the repo-level cspell.json words array or add a
.cspell-ignore file entry) so the token is treated as valid by the spellchecker
and the README.md table row no longer fails CI.
| - id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b | ||
| blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51 | ||
| sortingKey: "000001" | ||
| type: markdown | ||
| content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the description grammar.
The sentence is missing a verb.
✏️ Proposed fix
- content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.
+ content: This notebook is an A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b | |
| blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51 | |
| sortingKey: "000001" | |
| type: markdown | |
| content: This notebook A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance. | |
| - id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b | |
| blockGroup: 44a6df36-00e2-4eac-9d06-0d86f7c31b51 | |
| sortingKey: "000001" | |
| type: markdown | |
| content: This notebook is an A/B test statistical analysis tool that takes experiment data with control and treatment groups, calculates sample sizes for statistical power, performs t-tests and chi-square tests, computes confidence intervals, visualizes conversion rates with error bars, and provides recommendations based on statistical significance. |
🤖 Prompt for AI Agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote` around lines 15 - 19, The
markdown description (id: 7f0d0401-2bcd-4207-b0e2-db32e29a557b, type: markdown)
is missing a verb; update the sentence "This notebook A/B test statistical
analysis tool that takes experiment data..." to a grammatically correct form
such as "This notebook is an A/B test statistical analysis tool that takes
experiment data..." (or "This notebook provides an A/B test statistical analysis
tool..."), ensuring the rest of the description remains unchanged.
| # Basic info about the dataset | ||
| print("Shape:", df.shape) | ||
| print("\nColumn types:") | ||
| print(df.dtypes) | ||
| print("\nMissing values:") | ||
| print(df.isnull().sum()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Add a guard for df to avoid a NameError in the example.
This cell will fail if users run it before loading data.
🛡️ Suggested tweak
# Basic info about the dataset
+ if "df" not in globals():
+ raise ValueError("Load data into `df` before running this cell.")
print("Shape:", df.shape)
print("\nColumn types:")
print(df.dtypes)
print("\nMissing values:")
print(df.isnull().sum())📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Basic info about the dataset | |
| print("Shape:", df.shape) | |
| print("\nColumn types:") | |
| print(df.dtypes) | |
| print("\nMissing values:") | |
| print(df.isnull().sum()) | |
| # Basic info about the dataset | |
| if "df" not in globals(): | |
| raise ValueError("Load data into `df` before running this cell.") | |
| print("Shape:", df.shape) | |
| print("\nColumn types:") | |
| print(df.dtypes) | |
| print("\nMissing values:") | |
| print(df.isnull().sum()) |
🤖 Prompt for AI Agents
In `@examples/mcp-demos/ab_test_evaluator.deepnote` around lines 54 - 59, The cell
assumes the DataFrame variable df exists; add a guard that checks whether df is
defined and not None before accessing its attributes (e.g., using "if 'df' in
locals() or 'df' in globals()" or a try/except NameError) and, if not present,
print a short message like "DataFrame df not loaded — please run the data
loading cell" so the cell doesn't raise a NameError; update the block containing
the print(df.shape), print(df.dtypes), and print(df.isnull().sum()) to perform
this presence check first.
| blockGroup: a3392ca2-fd4a-4f2b-b451-cac1820517f8 | ||
| sortingKey: "000004" | ||
| type: input-text | ||
| content: "" | ||
| metadata: | ||
| deepnote_variable_name: api_key | ||
| deepnote_input_label: API Key | ||
| deepnote_input_default: "" | ||
| executionCount: null | ||
| outputs: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
Deepnote input block types masked password secret API key
💡 Result:
Deepnote Input blocks don’t include a “masked password / secret / API key” type. The built-in input types are things like Text, Select (single/multi), Date / Date range, File, Checkbox, Slider, plus a Button block—so anything entered in a text-style input is not meant to be treated as a hidden secret. (deepnote.com)
For passwords / secrets / API keys, the recommended approach in Deepnote is to store them as encrypted Environment Variables via Integrations → Environment variables, then read them in code (e.g., os.environ["MY_API_KEY"]). (deepnote.com)
Citations:
- 1: https://deepnote.com/docs/input-blocks?utm_source=openai
- 2: https://deepnote.com/docs/environment-variables?utm_source=openai
Use encrypted Environment Variables for API keys instead of input blocks.
Deepnote doesn't support masked/secret input types. Store the API key as an encrypted Environment Variable via Integrations → Environment variables, then access it in code (e.g., os.environ["MY_API_KEY"]). This avoids exposing secrets in shared notebooks.
🤖 Prompt for AI Agents
In `@examples/mcp-demos/api_analytics_client.deepnote` around lines 42 - 51, The
notebook currently stores the API key in an input-text block
(deepnote_variable_name: api_key / deepnote_input_label: API Key) which is not
masked; remove this input block and instead configure the API key as an
encrypted Environment Variable via Integrations → Environment variables, then
update any code that references the variable to read it from the environment
(e.g., use os.environ["MY_API_KEY"] or the equivalent in your runtime) and
ensure all references to "api_key" are replaced with the environment lookup.
| type: markdown | ||
| content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix description sentence.
Line 22 is missing a verb and reads awkwardly.
🛠️ Suggested fix
- content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.
+ content: This notebook is a customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| type: markdown | |
| content: This notebook Customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores. | |
| type: markdown | |
| content: This notebook is a customer churn prediction model that loads customer data, performs feature engineering on usage metrics, subscription history, and engagement data, trains a classification model with hyperparameter tuning, evaluates model performance with confusion matrix and ROC curve, and outputs churn probability scores. |
🤖 Prompt for AI Agents
In `@examples/mcp-demos/churn_prediction.deepnote` around lines 21 - 22, The
markdown sentence describing the notebook is missing a verb and reads awkwardly;
update the content string (the markdown block with "This notebook Customer churn
prediction model...") to include a verb and improve clarity — e.g., "This
notebook implements a customer churn prediction model that loads customer data,
performs feature engineering on usage metrics, subscription history, and
engagement data, trains a classification model with hyperparameter tuning,
evaluates model performance with a confusion matrix and ROC curve, and outputs
churn probability scores." Replace the existing content text accordingly.
| content: |- | ||
| from sklearn.metrics import classification_report, confusion_matrix | ||
| E880 import seaborn as sns | ||
|
|
||
| # Predictions | ||
| y_pred = model.predict(X_test) | ||
|
|
||
| # Classification report | ||
| print(classification_report(y_test, y_pred)) | ||
|
|
||
| # Confusion matrix | ||
| plt.figure(figsize=(8, 6)) | ||
| cm = confusion_matrix(y_test, y_pred) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
find . -name "churn_prediction.deepnote" -type fRepository: deepnote/deepnote
Length of output: 107
🏁 Script executed:
cat -n ./examples/mcp-demos/churn_prediction.deepnote | head -150Repository: deepnote/deepnote
Length of output: 6858
🏁 Script executed:
cat -n ./examples/mcp-demos/churn_prediction.deepnote | sed -n '1,130p' | grep -i "matplotlib\|import plt"Repository: deepnote/deepnote
Length of output: 43
Add matplotlib import before using plt.
Lines 136+ use plt without importing it, which will raise a NameError.
🛠️ Suggested fix
from sklearn.metrics import classification_report, confusion_matrix
import seaborn as sns
+import matplotlib.pyplot as plt🤖 Prompt for AI Agents
In `@examples/mcp-demos/churn_prediction.deepnote` around lines 124 - 136, The
snippet uses the symbol plt when plotting but never imports matplotlib; add an
import for matplotlib.pyplot (e.g., import matplotlib.pyplot as plt) before any
use of plt (place it alongside the other imports at the top of the cell/script
where y_pred = model.predict(...) and confusion_matrix are used) so that plt is
defined when calling plt.figure and subsequent plotting calls.
| if validate_output: | ||
| issues = validate_data(df_transformed) | ||
| if issues: | ||
| print("✗ Validation issues found:") | ||
| for issue in issues: | ||
| print(f" - {issue}") | ||
| else: | ||
| print("✓ Validation passed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation doesn’t stop loading invalid data.
Lines 192-199 only log issues; the Load step still writes output. Consider raising or gating with a flag to prevent bad data from landing.
🛠️ Suggested fix
if validate_output:
issues = validate_data(df_transformed)
if issues:
print("✗ Validation issues found:")
for issue in issues:
print(f" - {issue}")
+ raise ValueError("Validation failed; aborting load.")
else:
print("✓ Validation passed")🤖 Prompt for AI Agents
In `@examples/mcp-demos/etl_data_pipeline.deepnote` around lines 192 - 199, The
current validate_output block only logs validation issues returned by
validate_data(df_transformed) but does not prevent the subsequent Load step from
writing invalid data; change the flow so that when validate_output is True and
validate_data(...) returns any issues you either raise a ValidationError (or
RuntimeError) with the issue details or set/return a flag to abort the Load
step, ensuring the code that performs the load (the downstream write/load
routine) checks this flag or catches the exception and stops writing; update
validate_data usage and callers so failures short-circuit the pipeline (e.g.,
replace the print-only branch with a raise or return False that the load
function respects).
|
|
||
| | Example | Use Case | Industry | MCP Tools Used | | ||
| | ---------------------------------------------------------- | ----------------------------- | ------------------------------ | ---------------------------- | | ||
| | [SaaS Metrics Dashboard](saas_metrics_dashboard.deepnote) | KPI tracking, cohort analysis | SaaS (Slido, Statsig) | `template` + `enhance` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CSpell failure for “Slido”.
Line 11 trips CI spellcheck. Add a cspell ignore or dictionary entry for the brand name.
🛠️ Suggested fix
+<!-- cspell:ignore Slido -->🧰 Tools
🪛 GitHub Actions: CI
[error] 11-11: CSpell: Unknown word 'Slido'.
🤖 Prompt for AI Agents
In `@examples/mcp-demos/README.md` at line 11, The CI spellcheck flags the brand
name "Slido" in the table row for "SaaS Metrics Dashboard"; fix by adding a
cspell ignore or dictionary entry for "Slido" (e.g., add "Slido" to the
repo-level cspell.json words array or add a .cspell-ignore file entry) so the
token is treated as valid by the spellchecker and the README.md table row no
longer fails CI.
Summary by CodeRabbit
Documentation
New Features
✏️ Tip: You can customize this high-level summary in your review settings.