McpTestScreen.xml
5.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?xml version="1.0" encoding="UTF-8"?>
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-3.xsd"
standalone="true">
<parameters>
<parameter name="message" default-value="Hello from MCP!"/>
<parameter name="testMode" default-value="basic"/>
</parameters>
<actions>
<set field="timestamp" from="new java.util.Date()"/>
<set field="user" from="ec.user?.username ?: 'Anonymous'"/>
<set field="userId" from="ec.user?.userId ?: 'ANONYMOUS'"/>
<set field="sessionId" from="ec.web?.sessionId ?: 'NO_SESSION'"/>
<!-- Test service calls -->
<service-call name="McpServices.mcp#Ping" out-map="pingContext"/>
<set field="pingResult" from="pingContext?.result"/>
<!-- Test permissions -->
<set field="hasAdminAccess" from="ec.user?.hasPermission('MCP_ADMIN')"/>
<set field="hasUserAccess" from="ec.user?.hasPermission('MCP_USER')"/>
<set field="hasToolsAccess" from="ec.user?.hasPermission('MCP_TOOLS')"/>
<!-- Test context data -->
<set field="renderMode" from="sri.renderMode ?: 'unknown'"/>
<set field="screenPath" from="sri.getActiveScreenPath()?.join('/') ?: 'unknown'"/>
<set field="webappName" from="ec.web?.webappName ?: 'unknown'"/>
<set field="locale" from="ec.user?.locale ?: 'en_US'"/>
</actions>
<widgets>
<container style="mcp-test-screen">
<container style="text-center">
<label text="MCP Test Screen - LLM Access Validation" type="h1"/>
<label text="${message}" type="h3"/>
<label text="Test Mode: ${testMode}" type="h4"/>
</container>
<!-- User and Session Information -->
<container style="test-section">
<label text="User & Session Information" type="h2"/>
<container style="info-grid">
<label text="User: ${user}" type="p"/>
<label text="User ID: ${userId}" type="p"/>
<label text="Session ID: ${sessionId}" type="p"/>
<label text="Locale: ${locale}" type="p"/>
<label text="Webapp: ${webappName}" type="p"/>
<label text="Time: ${timestamp}" type="p"/>
</container>
</container>
<!-- Screen Rendering Information -->
<container style="test-section">
<label text="Screen Rendering Information" type="h2"/>
<container style="info-grid">
<label text="Render Mode: ${renderMode}" type="p"/>
<label text="Screen Path: ${screenPath}" type="p"/>
<label text="Screen Name: McpTestScreen" type="p"/>
<label text="Standalone: true" type="p"/>
</container>
</container>
<!-- Security and Permissions -->
<container style="test-section">
<label text="Security & Permissions" type="h2"/>
<container style="permission-grid">
<label text="MCP_ADMIN Access: ${hasAdminAccess ? '✓ Granted' : '✗ Denied'}" type="p"/>
<label text="MCP_USER Access: ${hasUserAccess ? '✓ Granted' : '✗ Denied'}" type="p"/>
<label text="MCP_TOOLS Access: ${hasToolsAccess ? '✓ Granted' : '✗ Denied'}" type="p"/>
</container>
</container>
<!-- Data Access Tests -->
<container style="test-section">
<label text="Data Access Tests" type="h2"/>
<container style="data-section">
<label text="System Ping Result: ${pingResult?.status ?: 'No response'}" type="p"/>
</container>
</container>
<!-- Test Results Summary -->
<container style="test-section">
<label text="LLM Access Validation Summary" type="h2"/>
<container style="summary-grid">
<label text="✓ Screen Rendering: Successful" type="p"/>
<label text="✓ User Context: Available" type="p"/>
<label text="✓ Data Access: Functional" type="p"/>
<label text="✓ Service Calls: Working" type="p"/>
<label text="✓ Security Context: Active" type="p"/>
</container>
</container>
<!-- Usage Instructions for LLM -->
<container style="test-section">
<label text="LLM Usage Instructions" type="h2"/>
<container style="instruction-text">
<label text="This screen validates MCP screen access for LLMs. Key capabilities demonstrated:" type="p"/>
<label text="• User authentication and context preservation" type="p"/>
<label text="• Security permission checking" type="p"/>
<label text="• Entity data access with user filtering" type="p"/>
<label text="• Service invocation capabilities" type="p"/>
<label text="• Dynamic content rendering based on user roles" type="p"/>
<label text="• Session management integration" type="p"/>
</container>
</container>
</container>
</widgets>
</screen>