Tool Execution Workflow
Every Model Context Protocol (MCP) tool call runs in a fresh process. There is no long-lived plugin instance shared between tool invocations in Ploinky, and each call boots SOPLang plugins again.
End-to-End Flow Diagram
Explorer user interface (UI) / MCP Browser Client
|
| callTool(name, input)
v
Ploinky Router -> AgentServer (/mcp)
|
| spawn command from mcp-config.json
v
/code/soplang-tool.sh (TOOL_NAME=...)
|
| read JSON payload from stdin
| deriveInvocation(toolName, payload)
v
Node wrapper runtime
|
| register SOPLang plugins
| register AchillesSkills plugin
| register SoplangBuilder plugin
| discover skills and register as SOPLang commands
v
targetPlugin[targetMethod](...params)
|
| optional workspace.forceSave() (tool specific)
| workspace.shutDown() (always at wrapper exit)
v
JSON result -> MCP response -> Explorer user interface
Detailed Execution Stages
- Dispatch: AgentServer reads
soplangAgent/mcp-config.jsonand executes/code/soplang-tool.shfor the selected tool. - Input bootstrap: wrapper reads stdin payload (
{ tool, input, metadata }) and validates required env variables likeTOOL_NAME. - Invocation mapping: tool name is mapped to plugin method by
plugins/lib/toolInvocation.mjs. - Plugin registration: SOPLang core plugins are loaded, then
AchillesSkillsandSoplangBuilderare registered. - Skill registration: Achilles skill catalog is discovered and each skill is registered as a SOPLang command (same process lifetime).
- Method execution: selected plugin method executes and returns JSON payload to stdout.
- Persistence finalize: some tools call
workspace.forceSave()during execution; wrapper then callsworkspace.shutDown()before process exit.
Persistence Notes
For document sync, the core implementation performs workspace.forceSave() after sync to persist state updates. Independently of tool type, wrapper-level shutdown executes workspace.shutDown() to close persistence cleanly.
This dual strategy guarantees disk persistence even when a tool mutates workspace state and exits immediately after completion.