User bio
404 bio not found
Member since Nov 9, 2015
Replies:
Timothy Leavitt · Dec 8, 2025 go to post

Sure! I have this class (extending %JSON.Adaptor rather than using https://github.com/intersystems/isc-json would be almost as good):

Class pkg.isc.mcp.message.BaseRequest Extends (Ens.Request, %pkg.isc.json.adaptor)
{

/// This method is called by the Management Portal to determine/// the content type that will be returned by the <method>%ShowContents</method>/// Override to application/json for pkg.isc.mcp.types.BaseModel.cls extends both/// %XML.Adaptor and %pkg.isc.json.adaptor but returns JSON
Method %GetContentType() As%String
{
  Quit"application/json"
}

Storage Default
{
<Type>%Storage.Persistent</Type>
}

}

With a subclass, pkg.isc.mcp.message.ToolCallRequest, that has a few more properties.

This shows up in the visual trace OOTB as:

Timothy Leavitt · Dec 4, 2025 go to post

Thanks! There's actually a reasonable level of built-in support for JSON display of messages at the platform level now (not *quite* as pretty as that package), you just need to have a JSONENABLED message class and override:

Method %GetContentType() As%String
{
	Quit"application/json"
}
Timothy Leavitt · Dec 1, 2025 go to post

A relevant note / tool I (re-?)discovered today: for critical sequences where an interrupt could leave the system in an inconsistent state, you can use the BREAK command to disable/enable Ctrl+C.
See: https://docs.intersystems.com/iris20191/csp/docbook/DocBook.UI.Page.cls…
Here's some sample code covering both the "tracking variable" and "destructor" patterns:

Class TSL.Breakfest Extends%RegisteredObject
{
 
ClassMethod Run()
{
	Set initialInterruptState = $ZJob\4#2Try {
		// Should be able to break during thisHang5Set e = 1/0
	} Catch e {
		// Should not be able to break starting here.Break0Write !,"bad stuff happened"Hang2
	}
	Break0// Should not be able to break during thisHang2Write !,"Got to the end of the critical cleanup step."Break initialInterruptState
}
 
ClassMethod RunObject()
{
	Set inst = ..%New()
	Hang2Write !,"Killing inst..."Kill inst
}
 
/// This callback method is invoked by the <METHOD>%Close</METHOD> method to /// provide notification that the current object is being closed./// /// <P>The return value of this method is ignored.
Method %OnClose() As%Status [ Private, ServerOnly = 1 ]
{
	Set initialInterruptState = $ZJob\4#2// Concern: what if the <INTERRUPT> hits exactly here between Set and Break? Extremely hard to test. Not sure if this could happen.Break0Hang2Write !,"Finished %OnClose"Break initialInterruptState
	Quit$$$OK
}
 
}
Open Exchange applications:
Certifications & Credly badges:
Followers:
Following: