Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Ean Schuessler
/
mo-mcp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
8d5420e0
authored
2025-11-19 23:33:24 -0600
by
Ean Schuessler
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fix ResourcesRead service by removing invalid artifactHit references
1 parent
6e68f0f3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
70 deletions
service/McpServices.xml
service/McpServices.xml
View file @
8d5420e
...
...
@@ -670,81 +670,56 @@
throw new Exception("Permission denied for entity: ${entityName}")
}
def startTime = System.currentTimeMillis()
try {
// Get entity definition for field descriptions
def entityInfoList = ec.entity.getAllEntityInfo(0, false)
def entityDef = entityInfoList.find { it.entityName == entityName }
if (!entityDef) {
throw new Exception("Entity not found: ${entityName}")
}
// Query entity data (limited to prevent large responses)
def entityList = ec.entity.find(entityName)
.limit(100)
.list()
def executionTime = (System.currentTimeMillis() - startTime) / 1000.0
// Build field info for LLM
def fieldInfo = []
entityDef.allFieldInfoList.each { field ->
fieldInfo
<<
[
name: field.name,
type: field.type,
description: field.description ?: "",
isPk: field.isPk,
required: field.notNull
]
}
// Convert to MCP resource content
def contents = [
[
uri: uri,
mimeType: "application/json",
text: new JsonBuilder([
entityName: entityName,
description: entityDef.description ?: "",
packageName: entityDef.packageName,
recordCount: entityList.size(),
fields: fieldInfo,
data: entityList
]).toString()
]
]
result = [contents: contents]
// Update audit record
artifactHit.runningTimeMillis = executionTime
artifactHit.wasError = "N"
artifactHit.outputSize = new JsonBuilder(result).toString().length()
ec.artifactExecution.disableAuthz()
try {
artifactHit.update()
} finally {
ec.artifactExecution.enableAuthz()
def startTime = System.currentTimeMillis()
try {
// Get entity definition for field descriptions
def entityInfoList = ec.entity.getAllEntityInfo(0, false)
def entityDef = entityInfoList.find { it.entityName == entityName }
if (!entityDef) {
throw new Exception("Entity not found: ${entityName}")
}
} catch (Exception e) {
def executionTime = (System.currentTimeMillis() - startTime) / 1000.0
// Update audit record with error
artifactHit.runningTimeMillis = executionTime
artifactHit.wasError = "Y"
artifactHit.errorMessage = e.message
ec.artifactExecution.disableAuthz()
try {
artifactHit.update()
} finally {
ec.artifactExecution.enableAuthz()
// Query entity data (limited to prevent large responses)
def entityList = ec.entity.find(entityName)
.limit(100)
.list()
def executionTime = (System.currentTimeMillis() - startTime) / 1000.0
// Build field info for LLM
def fieldInfo = []
entityDef.allFieldInfoList.each { field ->
fieldInfo
<<
[
name: field.name,
type: field.type,
description: field.description ?: "",
isPk: field.isPk,
required: field.notNull
]
}
// Convert to MCP resource content
def contents = [
[
uri: uri,
mimeType: "application/json",
text: new JsonBuilder([
entityName: entityName,
description: entityDef.description ?: "",
packageName: entityDef.packageName,
recordCount: entityList.size(),
fields: fieldInfo,
data: entityList
]).toString()
]
]
result = [contents: contents]
} catch (Exception e) {
def executionTime = (System.currentTimeMillis() - startTime) / 1000.0
throw new Exception("Error reading resource ${uri}: ${e.message}")
}
}
]]>
</script>
</actions>
</service>
...
...
Please
register
or
sign in
to post a comment