MCP Tool Examples: Difference between revisions
Jump to navigation
Jump to search
(Created page with "This page contains example scripts that can be used as MCP tools. Make sure to create the MCP tool scripts in a way that they return a string value. == List of Models == <syntaxhighlight lang="typescript" line> </syntaxhighlight>") |
|||
| Line 6: | Line 6: | ||
<syntaxhighlight lang="typescript" line> | <syntaxhighlight lang="typescript" line> | ||
let modelId = 161351; | |||
let result = Query(#{ | |||
"Dimensions": null, | |||
"Values": [ | |||
#{ | |||
"Name": "Model name", | |||
"Expression": "Name" | |||
}, | |||
#{ | |||
"Name": "Containing project name", | |||
"Expression": "Project.Name" | |||
}, | |||
#{ | |||
"Name": "Model ID", | |||
"Expression": "Id" | |||
}, | |||
#{ | |||
"Name": "Case attributes", | |||
"Expression": "ToJson(If(Status==\"Online\",OrderByValue(Flatten(EventLog.CaseAttributes.Name)), CasesDatatable?.ColumnNames ?? []))" | |||
}, | |||
#{ | |||
"Name": "Event attributes", | |||
"Expression": "ToJson(If(Status==\"Online\",OrderByValue(Flatten(EventLog.EventAttributes.Name)), EventsDatatable?.ColumnNames ?? []))" | |||
}, | |||
#{ | |||
"Name": "Case count", | |||
"Expression": "CasesDatatable?.NRows" | |||
}, | |||
#{ | |||
"Name": "Event count", | |||
"Expression": "EventsDatatable?.NRows" | |||
} | |||
], | |||
"Ordering": [ | |||
#{ | |||
"Name": "Containing project name", | |||
"Direction": "Ascending" | |||
}, | |||
#{ | |||
"Name": "Model name", | |||
"Direction": "Ascending" | |||
} | |||
], | |||
"Root": "Models", | |||
"ContextType": "generic" | |||
}).Collect(); | |||
return result.ToCsv(); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 00:31, 17 April 2026
This page contains example scripts that can be used as MCP tools.
Make sure to create the MCP tool scripts in a way that they return a string value.
List of Models
let modelId = 161351;
let result = Query(#{
"Dimensions": null,
"Values": [
#{
"Name": "Model name",
"Expression": "Name"
},
#{
"Name": "Containing project name",
"Expression": "Project.Name"
},
#{
"Name": "Model ID",
"Expression": "Id"
},
#{
"Name": "Case attributes",
"Expression": "ToJson(If(Status==\"Online\",OrderByValue(Flatten(EventLog.CaseAttributes.Name)), CasesDatatable?.ColumnNames ?? []))"
},
#{
"Name": "Event attributes",
"Expression": "ToJson(If(Status==\"Online\",OrderByValue(Flatten(EventLog.EventAttributes.Name)), EventsDatatable?.ColumnNames ?? []))"
},
#{
"Name": "Case count",
"Expression": "CasesDatatable?.NRows"
},
#{
"Name": "Event count",
"Expression": "EventsDatatable?.NRows"
}
],
"Ordering": [
#{
"Name": "Containing project name",
"Direction": "Ascending"
},
#{
"Name": "Model name",
"Direction": "Ascending"
}
],
"Root": "Models",
"ContextType": "generic"
}).Collect();
return result.ToCsv();