Skip to main content
Glama

pfc_execute_task

Submit a Python script for background execution in PFC. Get a task ID to poll progress, cancel, or modify variables mid-run using companion tools.

Instructions

Submit a Python script file for asynchronous execution in PFC.

Returns a task_id immediately; the script runs in the background. Use the companion tools to manage the task lifecycle:

  • pfc_check_task_status: poll output, progress, and final status

  • pfc_interrupt_task: cancel a running task

  • pfc_list_tasks: browse task history

While the task is cycling, you can call pfc_execute_code at any time to inspect or modify simulation state — including variables the task depends on. This is the standard way to probe progress, tune parameters mid-run, swap callbacks, or trigger early termination via a sentinel variable. Both tools share the same main namespace in PFC's main thread.

Console output from itasca.command() inside the script — table dumps, list output, command summaries — is captured and interleaved with Python prints in the task log, visible through pfc_check_task_status.

Do NOT have the script invoke program call '<file>.p3dat' (or .p2dat / .dat). PFC's command-script interpreter blocks the bridge for the script's entire duration with no cycle-gap interleaving, leaving the bridge unreachable until PFC is stopped manually. If the user asks to run a .dat / .p3dat / .p2dat file, read the file and translate its commands into a sequence of itasca.command(...) calls in the Python script instead.

This is the async / background execution path: pollable via pfc_check_task_status, cancellable via pfc_interrupt_task. Submission does not lock parameters — start with reasonable values and refine live via pfc_execute_code as the task cycles. For synchronous, inline execution, use pfc_execute_code directly.

Submission uses the bridge's execute_task protocol message. If a submission times out, the connected bridge may predate it — confirm its version with pfc_execute_code (import itasca_mcp_bridge; print(itasca_mcp_bridge.__version__)). To upgrade, fetch and follow the bootstrap guide, then resubmit: https://raw.githubusercontent.com/yusong652/pfc-mcp/main/docs/agentic/pfc-mcp-bootstrap.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entry_scriptYesAbsolute path to entry Python script in PFC workspace
descriptionYesBrief task purpose

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Discloses async behavior, immediate task_id return, background execution, pollable/cancellable nature, ability to modify state during execution via pfc_execute_code, namespace sharing, console output interleaving, and timeout resolution. No annotations exist, so burden is fully on description.

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?

Front-loaded with primary action, then logically structured with lifecycle details, sync alternative, warnings, and troubleshooting. Every sentence adds information without redundancy.

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?

Given the complexity of async task submission with lifecycle management, the description covers all necessary aspects: async behavior, sibling tools, namespace sharing, console output, .dat file warning, timeout handling, and references to external resources. Output schema existence (task_id) is noted.

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 described 100% of parameters. Description adds context (absolute path, workspace) for entry_script, and purpose for description. While schema already has descriptions, the description integrates parameter usage into the async execution flow, providing added value.

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 'Submit a Python script file for asynchronous execution in PFC' and differentiates from sibling pfc_execute_code by specifying sync vs async paths. It also contrasts with pfc_check_task_status, pfc_interrupt_task, pfc_list_tasks for lifecycle management.

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

Usage Guidelines5/5

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

Explicitly states when to use (async/background) and when not (use pfc_execute_code for sync), provides alternatives for .dat file execution, and warns against blocking practices. Troubleshooting steps for timeouts are included.

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

Install Server

Other Tools

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/yusong652/pfc-mcp'

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