Skip to main content
Glama

extract_function

Extract a named function with its imports and helpers into a standalone program, then execute it in a sandbox to test per-input runs.

Instructions

Extract a named function (with its imports + referenced helpers) into a standalone program and run it in the sandbox.

python3 gets exact ast extraction; other languages best-effort block extraction (pass call to execute non-python). Returns the extracted program and per-input runs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
callNo
codeYes
languageYes
test_inputsNo
function_nameYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed8 schema fields changedv0.2.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / call / title
      Added value: +"Call"
    • addedInput schema / properties / code / title
      Added value: +"Code"
    • addedInput schema / properties / function_name / title
      Added value: +"Function Name"
    • addedInput schema / properties / language / title
      Added value: +"Language"
    • addedInput schema / properties / test_inputs / title
      Added value: +"Test Inputs"
    • addedInput schema / title
      Added value: +"extract_functionArguments"
    • changedOutput schema / (root)
      Previous value: -{
      -  "additionalProperties": true,
      -  "type": "object"
      -}New value: +null
  2. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the burden. It discloses language-dependent extraction accuracy, mentions the `call` parameter for non-python execution, and states the return format ('extracted program and per-input runs'). However, it omits side effects, sandbox details, error behavior, or how missing imports/helpers are handled.

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

Conciseness4/5

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

The description is brief and front-loaded with the core purpose. The second sentence packs language support and the `call` parameter into one clause, making it slightly dense but still efficient with no wasted words.

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

Completeness2/5

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

Given 5 parameters, no annotations, and no output schema, the description lacks necessary context. It explains the return value and some language caveats, but fails to cover all parameters or specify edge cases, failure modes, or sandbox implications, leaving the tool under-specified for reliable invocation.

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

Parameters2/5

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

Schema coverage is 0% and the description only adds meaning for `call` ('pass `call` to execute non-python'). The other parameters (code, language, function_name, test_inputs) are not explicitly explained; their semantics must be inferred from the tool name and schema titles. The description does not compensate for the low coverage.

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?

The description clearly states a specific action: 'Extract a named function (with its imports + referenced helpers) into a standalone program and run it in the sandbox.' This uses a strong verb and resource, and the extraction+execution purpose distinguishes it from sibling execution tools like session_run or execute_code.

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

Usage Guidelines3/5

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

Usage guidance is implied: the tool is for extracting and running functions. It provides language-specific behavior ('python3 gets exact ast extraction; other languages best-effort') and mentions `call` for non-python execution, but it does not explicitly say when to choose this over alternatives or when not to use it.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/The-40-Thieves/codecalc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server