Skip to main content
Glama

java_exec

Run custom Java code in Creo using the full Object TOOLKIT API on the main thread to handle tasks no existing tool covers.

Instructions

Run Java code inside Creo with the full Object TOOLKIT Java API (pfc + wfc packages, all imported) on Creo's main thread: the escape hatch for anything no tool covers.

code is the body of static Object run(Session session, Map<String,Object> args); return a JSON-able value (Map/List/String/number/boolean). System.out is captured. Helpers: Api.solid(session, file|null), Api.item(solid, ref, type), Api.select(solid, ref, type), Api.feature(solid, nameOrId), Api.describe(item), Api.tree(session, solid, jsonTree). Example: Solid s = Api.solid(session, null); return s.ListFeaturesByType(true, null).getarraysize(); API docs: Creo's Object TOOLKIT Java APIWizard (Common Files/otk_java_doc). Long loops block Creo.

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": {
      "code": "<code>"
    },
    "name": "java_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNo
codeYes
timeoutNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations, the description carries the burden and delivers real operational facts: execution on Creo's main thread, System.out capture, a JSON-able return contract, and the warning that 'Long loops block Creo.' It omits what happens on exception, and gives no semantics for the timeout parameter (e.g. whether the code is killed or the call merely returns), which keeps it from a 5.

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?

Front-loaded with the core purpose and the escape-hatch rule, then progressively more specific detail, a runnable example, and docs pointer. Dense but every line is functional; the APIWizard path reference is the only mildly low-value fragment.

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

Completeness4/5

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

An output schema exists so return values need not be explained, and the description still adds the JSON-ability constraint that the schema alone would not convey. For an arbitrary-code-execution tool the gaps around exception propagation and timeout behavior are the only meaningful omissions.

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 0% across three parameters, so the description must compensate. It does well for `code`, spelling out the exact `static Object run(Session session, Map<String,Object> args)` body contract, and the signature implicitly explains `args`, but `timeout` is never mentioned and no value guidance or units are given for it.

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 ('Run Java code inside Creo') plus the execution surface ('full Object TOOLKIT Java API (pfc + wfc packages)') and positions itself as the fallback of last resort. An agent can immediately tell this apart from the specialized feature_*/asm_* siblings.

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?

The phrase 'the escape hatch for anything no tool covers' gives a clear, actionable selection rule: prefer dedicated tools, use this only when none applies. It stops short of naming explicit exclusions or ordering the fallback against specific siblings, so it is strong context rather than a full when/when-not matrix.

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