Package com.ssgllc.fish.config.mcp
Class McpConfigurationConfig.ConfigurationTools
java.lang.Object
com.ssgllc.fish.config.mcp.McpConfigurationConfig.ConfigurationTools
- Enclosing class:
McpConfigurationConfig
Tool implementations for configuration and data-model introspection.
Backed by ConfigSearchService,
ApplicationService,
ValueSets, and
AbstractAppCacheRefreshMessageProducer.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final com.fasterxml.jackson.databind.ObjectMapper -
Method Summary
Modifier and TypeMethodDescriptionRegisters newly generated entities and fields into the configuration, update-resolution, case-linkable, and REST-resource subsystems — the same operation the admin UI's "add missing entities and fields" action performs.protected StringbytesToString(byte[] bytes) Decodes a byte array to a UTF-8 string.configSearch(String term, String entityType, Boolean caseSensitive, Boolean includeExpensive, Integer maxOccurrencesPerPath, Integer page, Integer pageSize) Searches all Casetivity configuration item types for an exact text term and returns the matching items with the specific field paths containing the match.protected StringProduces a standard{"error":"<message>"}JSON response from an exception.Returns a sanitized view of the application's runtime configuration node, sourced fromApplicationService.getAppConfigNode().getEntityDataModel(String entityNames, Integer connectionDepth, Boolean includeRelationshipDetails) Returns the data model for the requested entities including field names, data types, value-set codes, and relationship metadata.getValueSet(String valueSetCode, Boolean includeInactive) Returns all concepts in a value set.protected StringhandleTool(Callable<Object> action) Invokesaction, serializes the result withtoJson(java.lang.Object), and returns it.importValueSets(String rowsJson, Boolean dryRun, String featureBranch) Bulk-imports value sets and their concepts from flat concept rows (one row per concept, each carrying itsvalueSetCode).listEntityNames(Boolean core, String category) Lists all entity type names currently registered in the application data model.ping()Lightweight health/auth probe.refreshCaches(String cacheType) Publishes a cache refresh event viaAbstractAppCacheRefreshMessageProducer.sendTopic(AppCacheType).searchConcepts(String valueSetCode, String searchText) Case-insensitive substring search across concept codes and display names in a value set.protected StringSerializesvalueto a compact JSON string (no indent).
-
Field Details
-
mapper
protected final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Details
-
configSearch
@Tool(name="config-search", description="Full-text search across all configuration items for an exact term.") public String configSearch(@ToolParam(description="Text term to search for") String term, @ToolParam(required=false,description="Config type filter; omit for all") String entityType, @ToolParam(required=false,description="Case-sensitive; defaults to false") Boolean caseSensitive, @ToolParam(required=false,description="Include blob/document content") Boolean includeExpensive, @ToolParam(required=false,description="Max matched paths per item") Integer maxOccurrencesPerPath, @ToolParam(required=false,description="0-indexed page; defaults to 0") Integer page, @ToolParam(required=false,description="Results per page; defaults to 50") Integer pageSize) Searches all Casetivity configuration item types for an exact text term and returns the matching items with the specific field paths containing the match. Results are paged; usepageandpageSizefor large result sets.- Parameters:
term- text to search for (exact substring, not regex)entityType- optional config type filter (e.g.viewdef,texttemplate)caseSensitive- iftrue, match is case-sensitive; defaultfalseincludeExpensive- iftrue, also searches blob/document content; defaultfalsemaxOccurrencesPerPath- maximum matched paths per config item;nullmeans no limitpage- 0-indexed page number; default 0pageSize- results per page; default 50- Returns:
- paged JSON result with matched config items and their matching field paths
-
listEntityNames
@Tool(name="list-entity-names", description="List all entity type names in the data model.") public String listEntityNames(@ToolParam(required=false,description="true=core, false=custom, omit=all") Boolean core, @ToolParam(required=false,description="Filter by entity category") String category) Lists all entity type names currently registered in the application data model. Optionally filters to core (platform-built-in) or custom (application-specific) entities and/or by category. Call this beforeget-entity-data-modelto discover valid names.- Parameters:
core-true= core only,false= custom only,null= allcategory- optional category filter (e.g.business,system)- Returns:
- JSON array of entity name strings
-
getEntityDataModel
@Tool(name="get-entity-data-model", description="Get fields, types, value sets, and relationships for one or more entities.") public String getEntityDataModel(@ToolParam(description="Comma-separated entity names") String entityNames, @ToolParam(required=false,description="Relationship hops to follow (0-3)") Integer connectionDepth, @ToolParam(required=false,description="Include DB-level join metadata") Boolean includeRelationshipDetails) Returns the data model for the requested entities including field names, data types, value-set codes, and relationship metadata. SetconnectionDepth> 0 to include related entities up to that many hops away (max 3).- Parameters:
entityNames- comma-separated entity names; at least one is requiredconnectionDepth- BFS hop depth for following relationships; 0 = exact entities onlyincludeRelationshipDetails- whentrue, includes DB-level join metadata- Returns:
- JSON object keyed by entity name, each containing its field and relationship descriptors
-
getValueSet
@Tool(name="get-value-set", description="Get all concepts in a value set by code.") public String getValueSet(@ToolParam(description="Value set code") String valueSetCode, @ToolParam(required=false,description="Include inactive concepts") Boolean includeInactive) Returns all concepts in a value set. Each concept includes itsid,code,displayName,description, andactiveflag.- Parameters:
valueSetCode- value set code (e.g.GENDER,RACE)includeInactive- whentrue, includes inactive concepts; defaultfalse- Returns:
- JSON array of concept objects
-
searchConcepts
@Tool(name="search-concepts", description="Search concepts in a value set by substring match on code or display name.") public String searchConcepts(@ToolParam(description="Value set code") String valueSetCode, @ToolParam(description="Case-insensitive search substring") String searchText) Case-insensitive substring search across concept codes and display names in a value set. Use this when you know roughly what concept you need but not its exact code.- Parameters:
valueSetCode- value set codesearchText- case-insensitive substring to match against code or displayName- Returns:
- JSON array of matching concept objects
-
getApplicationDetails
@Tool(name="get-application-details", description="Get environment name, feature flags, data source config, and active integrations. Text values over 2000 chars (css/html blobs) are replaced with a size note; fetch those via config-search or execute-groovy-script if needed.") public String getApplicationDetails()Returns a sanitized view of the application's runtime configuration node, sourced fromApplicationService.getAppConfigNode(). Sensitive values (passwords, tokens) are not included.String field values longer than 2000 characters (tenant CSS, embedded HTML) are replaced with a size note so the field stays visible without dominating the response.
- Returns:
- JSON object with environment name, feature flags, data-source info, authentication providers, and other runtime settings
-
refreshCaches
@Tool(name="refresh-caches", description="Trigger an application cache refresh, optionally scoped to one cache type.") public String refreshCaches(@ToolParam(required=false,description="Cache type; defaults to ALL") String cacheType) Publishes a cache refresh event viaAbstractAppCacheRefreshMessageProducer.sendTopic(AppCacheType). The refresh is asynchronous — this tool returns immediately after publishing the event. The actual cache reload happens on the listener side (JMS, SNS, sync, or Weblogic, depending on the activecacheSyncProviderconfiguration).Valid
cacheTypevalues (seeAppCacheType):Permission,EntityConfig,ValueSet,User,Process,NickName,FrontendIndex,PrintTemplate,Custom,ALL.- Parameters:
cacheType- cache scope to refresh; defaults toALLwhen omitted- Returns:
- JSON object
{"status":"requested","cacheType":"<type>"}
-
addMissingEntitiesAndFields
@Tool(name="add-missing-entities-and-fields", description="Register newly generated entities/fields into the config, update-resolution, case-linkable, and REST subsystems. Run after a data-model rebuild. Idempotent; refreshes caches internally.") public String addMissingEntitiesAndFields()Registers newly generated entities and fields into the configuration, update-resolution, case-linkable, and REST-resource subsystems — the same operation the admin UI's "add missing entities and fields" action performs. Must be run after any data-model rebuild before new entities are usable via update, case-link, or REST. Idempotent (adds only what is missing) and refreshes affected caches internally, so no follow-uprefresh-cachesis required.- Returns:
- JSON object
{"status":"done"}
-
ping
@Tool(name="ping", description="Health/auth probe: returns up, whether the caller\'s authentication is valid, and the current user login.") public String ping()Lightweight health/auth probe. Returns immediately without touching application state. Call it before a long operation, or when a request hangs or times out, to distinguish a down backend / expired session from a configuration problem.- Returns:
- JSON object
{"status":"up","authValid":<boolean>,"user":"<login>"}
-
importValueSets
@Tool(name="import-value-sets", description="Bulk create/update value sets and their concepts from flat concept rows (keys: valueSetCode, code, display required; optional description, group, sortOrder, active, deactivateMissing, valueSetDisplay, valueSetDescription). Rows are grouped by valueSetCode and applied atomically. Set dryRun=true to return the add/update/leftover diff without persisting. featureBranch attributes the change to a config feature branch.") public String importValueSets(@ToolParam(description="JSON array of flat concept rows keyed by valueSetCode/code/display (+ optional fields)") String rowsJson, @ToolParam(required=false,description="If true, return the diff without persisting; defaults to false") Boolean dryRun, @ToolParam(required=false,description="Config audit feature branch") String featureBranch) Bulk-imports value sets and their concepts from flat concept rows (one row per concept, each carrying itsvalueSetCode). Rows are grouped into value sets; existing value sets are updated in place (concepts added/updated, and missing ones deactivated when a row setsdeactivateMissing), and unknown value sets are created. The whole batch is applied atomically. Replaces many one-at-a-timecreate-entity Conceptcalls.Row keys:
valueSetCode,code,display(all required) plus optionaldescription,group,sortOrder,active,deactivateMissing,valueSetDisplay,valueSetDescription. Optional keys are applied only when present, preserving existing values otherwise.- Parameters:
rowsJson- JSON array of flat concept rowsdryRun- whentrue, returns the add/update/leftover diff without persisting- Returns:
- the dry-run diff, or
{"status":"imported","count":N,"valueSets":[codes]}on apply
-
toJson
Serializesvalueto a compact JSON string (no indent). Returns{"error":"serialization failed"}if serialization throws.- Parameters:
value- the object to serialize; may benull- Returns:
- compact JSON string
-
bytesToString
Decodes a byte array to a UTF-8 string. Used to convert binary report output to a returnable string.- Parameters:
bytes- raw bytes- Returns:
- decoded string
-
handleTool
Invokesaction, serializes the result withtoJson(java.lang.Object), and returns it. Any exception thrown by the action is caught and converted to a standard{"error":"<message>"}response viaerrorJson(java.lang.Exception). Use this in every@Toolmethod to eliminate identical try/catch boilerplate.- Parameters:
action- the tool logic to invoke; may throw any exception- Returns:
- compact JSON string — the serialized result on success, or an error object on failure
-
errorJson
Produces a standard{"error":"<message>"}JSON response from an exception. Falls back to the simple class name whenThrowable.getMessage()is null.- Parameters:
e- the exception to convert- Returns:
- JSON error string
-