Skip to main content
Glama

sim_code_to_flow

Destructive

Derive a Petri-net model from source code with the configured LLM (control-flow, state-machine, resources or concurrency focus) and store it as a NEW model you own when it passes sim_create_model's decode and the model validator. Stored, it returns stored: true with id, url, name, usage and warnings (what sim_create_model would warn about the model, omitted when there is nothing to say). Otherwise nothing is stored, and it returns stored: false with the LLM's model JSON as model, usage, and either error — one string: the decode failure ("response is not a model: ...") or the unknown-field refusal worded as sim_create_model words it, each misspelt key by path with the key it most likely meant and the structural reasons after them — or errors, the validator's list (each with code, message and fix); fix the JSON and store it with sim_create_model. A reply with no JSON object in it, or a model the store's own validation still refuses, is a tool error naming why. Runs generator.CodeToFlow directly; this tool is its only surface on sim.pflow.xyz, which mounts no code-to-flow HTTP endpoint. Needs sign-in; refused when this deployment has no LLM provider configured.

Input Schema

NameRequiredDescriptionDefault
codeYessource code to analyse
nameNoname for the derived model; the LLM is asked to use it, and it is filled in, before any check, when the model comes back without one
focusNocontrol-flow (default), state-machine, resources or concurrency
languageNosource language hint, e.g. go, python, javascript

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / name / description
      Previous value: -"name for the derived model"New value: +"name for the derived model; the LLM is asked to use it, and it is filled in, before any check, when the model comes back without one"
  2. First observed

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already flag a non-read-only, destructive, non-idempotent, open-world write; the description goes well beyond them by disclosing the sign-in requirement, the deployment precondition (no LLM provider configured = refused), that it calls generator.CodeToFlow directly with no HTTP endpoint, and the exact shape of both success and failure returns.

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

Conciseness3/5

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

The scoping and success/failure contract is front-loaded, but the narrative collapses into a single run-on paragraph dense with parenthetical caveats ('what sim_create_model would warn about the model, omitted when there is nothing to say'), which costs readability without adding much.

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 fully carries the return contract — stored/id/url/name/usage/warnings on success, model/error/errors on failure, and the tool-error case — which is exactly what an agent needs before invoking an opaque LLM derivation.

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

Parameters3/5

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

Schema description coverage is 100%, so every parameter is already documented, and the description adds little parameter-level detail beyond echoing the focus values that already appear in the schema. Baseline 3 is appropriate when the schema does the work.

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 first sentence states a precise verb and resource: derive a Petri-net model from source code via the configured LLM, with an explicit focus dimension, into a NEW owned model. It also names the sibling it depends on (sim_create_model) and the failure paths, so an agent can distinguish it from sim_create_model or sim_compose without opening a schema.

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?

It clearly states the success condition (stored only if decode plus validator pass) and the recovery path (fix the JSON and store it with sim_create_model), which is genuine when-to-use guidance. It does not, however, say when to prefer this over other derivation siblings such as sim_compose or sim_distill.

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.

Resources