[ 
https://issues.apache.org/jira/browse/CAY-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrus Adamchik updated CAY-2942:
---------------------------------
    Description: 
Add a new {{cgen_run}} tool to the CayenneModeler MCP server (on top of 
CAY-2936 scaffolding) that runs Cayenne's class generator for a single DataMap, 
using the {{cgen}} config already stored in the DataMap XML. Inputs are an 
absolute {{projectPath}} to the top-level {{cayenne-*.xml}} and a {{dataMap}} 
symbolic name. The tool reports only the runtime delta — what cgen did on disk 
— since the agent can read config from XML on its own.

Validation runs in fixed order and short-circuits: project readable, parses, 
DataMap present, cgen config present, destDir specified, destDir writable. The 
response envelope is always the same shape: {{status}} ({{{}generated{}}}, 
{{{}up_to_date{}}}, {{{}validation_failed{}}}, {{{}error{}}}), {{summary}} with 
filesConsidered/filesWritten, a {{files}} array of written files (each with 
server-classified {{kind}} and {{sourceEntity}}), {{{}resolved.destDir{}}}, 
captured warnings, a per-step {{validation}} block, and an {{error}} object 
with a stable code enum.

Tool response structure:
{noformat}
{
  "status": "generated" | "up_to_date" | "validation_failed" | "error",
  "summary": {
    "filesConsidered": 0,
    "filesWritten": 0
  },
  "files": [
    {
      "path": "/abs/path/Foo.java",
      "kind": "datamap" | "entity-super" | "entity-sub" | "embeddable-super" | 
"embeddable-sub",
      "sourceEntity" : "Foo"
    }
  ],
  "resolved": {
    "destDir": "/abs/path/src/main/java"
  },
  "warnings": ["..."],
  "validation": {
    "projectFound": true,
    "dataMapFound": true,
    "cgenConfigPresent": true,
    "destDirSpecified": true,
    "destDirWritable": true
  },
  "error": {"code" : ..., "message" : "..."} 
}
{noformat}


  was:
Add a new {{cgen_run}} tool to the CayenneModeler MCP server (on top of 
CAY-2936 scaffolding) that runs Cayenne's class generator for a single DataMap, 
using the {{cgen}} config already stored in the DataMap XML. Inputs are an 
absolute {{projectPath}} to the top-level {{cayenne-*.xml}} and a {{dataMap}} 
symbolic name. The tool reports only the runtime delta — what cgen did on disk 
— since the agent can read config from XML on its own.

Validation runs in fixed order and short-circuits: project readable, parses, 
DataMap present, cgen config present, destDir specified, destDir writable. The 
response envelope is always the same shape: {{status}} ({{{}generated{}}}, 
{{{}up_to_date{}}}, {{{}validation_failed{}}}, {{{}error{}}}), {{summary}} with 
filesConsidered/filesWritten, a {{files}} array of written files (each with 
server-classified {{kind}} and {{{}sourceEntity{}}}), {{{}resolved.destDir{}}}, 
captured warnings, a per-step {{validation}} block, and an {{error}} object 
with a stable code enum.


> CayenneModeler MCP: cgen_run tool
> ---------------------------------
>
>                 Key: CAY-2942
>                 URL: https://issues.apache.org/jira/browse/CAY-2942
>             Project: Cayenne
>          Issue Type: Task
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>            Priority: Major
>             Fix For: 5.0-M2
>
>
> Add a new {{cgen_run}} tool to the CayenneModeler MCP server (on top of 
> CAY-2936 scaffolding) that runs Cayenne's class generator for a single 
> DataMap, using the {{cgen}} config already stored in the DataMap XML. Inputs 
> are an absolute {{projectPath}} to the top-level {{cayenne-*.xml}} and a 
> {{dataMap}} symbolic name. The tool reports only the runtime delta — what 
> cgen did on disk — since the agent can read config from XML on its own.
> Validation runs in fixed order and short-circuits: project readable, parses, 
> DataMap present, cgen config present, destDir specified, destDir writable. 
> The response envelope is always the same shape: {{status}} 
> ({{{}generated{}}}, {{{}up_to_date{}}}, {{{}validation_failed{}}}, 
> {{{}error{}}}), {{summary}} with filesConsidered/filesWritten, a {{files}} 
> array of written files (each with server-classified {{kind}} and 
> {{sourceEntity}}), {{{}resolved.destDir{}}}, captured warnings, a per-step 
> {{validation}} block, and an {{error}} object with a stable code enum.
> Tool response structure:
> {noformat}
> {
>   "status": "generated" | "up_to_date" | "validation_failed" | "error",
>   "summary": {
>     "filesConsidered": 0,
>     "filesWritten": 0
>   },
>   "files": [
>     {
>       "path": "/abs/path/Foo.java",
>       "kind": "datamap" | "entity-super" | "entity-sub" | "embeddable-super" 
> | "embeddable-sub",
>       "sourceEntity" : "Foo"
>     }
>   ],
>   "resolved": {
>     "destDir": "/abs/path/src/main/java"
>   },
>   "warnings": ["..."],
>   "validation": {
>     "projectFound": true,
>     "dataMapFound": true,
>     "cgenConfigPresent": true,
>     "destDirSpecified": true,
>     "destDirWritable": true
>   },
>   "error": {"code" : ..., "message" : "..."} 
> }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to