Skip to main content
Glama

Get runnable R, Python, or Julia code

get_code
Read-onlyIdempotent

Get runnable code from the library for a specific statistical, econometric, causal inference, or machine learning task, in R, Python, or Julia. Suited to requests for code that carries out a named estimator, test, or modeling step; it returns code with brief context, not an explanation of the method. Results can be restricted to one language or one work. Returns code blocks with the section they come from, the packages they use, a link, and a citation.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "topic": "<topic>"
    },
    "name": "get_code"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoNumber of sections to return code from (default 4).
topicYesThe task, e.g. "Callaway and Sant'Anna group-time ATT", "rdrobust bandwidth", "WoE binning scorecard".
sourceNoLimit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); regsensitivity (regsensitivity: Regression Sensitivity Analysis for Omitted Variable Bias); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); meta_analysis (Meta-Analysis: A Practical and Modern Guide with R); publications (Research Articles and Publications).
languageNoProgramming language of the code: r, python, or julia.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); regsensitivity (regsensitivity: Regression Sensitivity Analysis for Omitted Variable Bias); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); regsensitivity (regsensitivity: Regression Sensitivity Analysis for Omitted Variable Bias); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); meta_analysis (Meta-Analysis: A Practical and Modern Guide with R); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "regsensitivity",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "advanced_data_analysis",
      -  "tidy_finance_vn",
      -  "tidy_finance_vn_vi",
      -  "social_theory",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "regsensitivity",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "social_theory",
      +  "meta_analysis",
      +  "publications"
      +]
  2. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); regsensitivity (regsensitivity: Regression Sensitivity Analysis for Omitted Variable Bias); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "advanced_data_analysis",
      -  "tidy_finance_vn",
      -  "tidy_finance_vn_vi",
      -  "social_theory",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "regsensitivity",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "social_theory",
      +  "publications"
      +]
  3. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "advanced_data_analysis",
      -  "tidy_finance_vn",
      -  "tidy_finance_vn_vi",
      -  "mlpy",
      -  "social_theory",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "social_theory",
      +  "publications"
      +]
  4. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); social_theory (Social Science Theory: A Field Guide to the Theories, Effects, and Frameworks Behind Research and Business); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "advanced_data_analysis",
      -  "tidy_finance_vn",
      -  "tidy_finance_vn_vi",
      -  "mlpy",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "mlpy",
      +  "social_theory",
      +  "publications"
      +]
  5. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); comm_theory (Communication Theory); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "advanced_data_analysis",
      -  "tidy_finance_vn",
      -  "tidy_finance_vn_vi",
      -  "mlpy",
      -  "comm_theory",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "mlpy",
      +  "publications"
      +]
  6. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); publications (Research Articles and Publications)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); advanced_data_analysis (Advanced Data Analysis); tidy_finance_vn (Applying Tidy Finance with Python to Vietnam); tidy_finance_vn_vi (Tài Chính Ứng Dụng với Python); mlpy (Machine Learning in Python); comm_theory (Communication Theory); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action",
      -  "publications"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "advanced_data_analysis",
      +  "tidy_finance_vn",
      +  "tidy_finance_vn_vi",
      +  "mlpy",
      +  "comm_theory",
      +  "publications"
      +]
  7. Changed2 schema fields changed
    • changedInput schema / properties / source / description
      Previous value: -"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence)."New value: +"Limit to one work: data_analysis (A Guide on Data Analysis); causalverse (causalverse: The All-in-One Causal Inference Toolkit); credit_score (Credit Scoring: Theory, Methods, and Practice); marketing_research (Marketing Research: A Technical and Academic Treatment); ai_in_action (AI in Action: A Reference for Artificial Intelligence); publications (Research Articles and Publications)."
    • changedInput schema / properties / source / enum
      Previous value: -[
      -  "data_analysis",
      -  "causalverse",
      -  "credit_score",
      -  "marketing_research",
      -  "ai_in_action"
      -]New value: +[
      +  "data_analysis",
      +  "causalverse",
      +  "credit_score",
      +  "marketing_research",
      +  "ai_in_action",
      +  "publications"
      +]
  8. First observed

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover the safety profile (read-only, idempotent, closed-world, non-destructive), and the description goes beyond them by describing the return payload: code blocks annotated with source section, packages used, link, and citation, plus a default of 4 sections. This tells an agent what it will actually receive, which annotations cannot convey.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the core action, then usage fit, then return shape. Every sentence carries distinct information and nothing is repeated from the schema or annotations.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description takes on the burden of explaining return values and does so concretely (code blocks, section provenance, packages, link, citation). Combined with full schema coverage and clear read-only annotations, an agent has everything needed to call this correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds genuine meaning by stating that results 'can be restricted to one language or one work', explaining the intent behind the language and source filters rather than just their enumerations. It does not mention the limit parameter, leaving that entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Get runnable code from the library') plus the domain of tasks it covers (statistical, econometric, causal inference, machine learning) and the three target languages. The output orientation ('returns code, not method explanation') separates it cleanly from siblings like search or choose_method without needing to name them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly scopes use to 'requests for code that carries out a named estimator, test, or modeling step' and adds an exclusion ('not an explanation of the method'), which steers agents toward an explanatory tool when that is what the user wants. It stops short of naming the specific sibling to use instead, so it is strong but not fully routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.