You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test(mcp): add integration test for tool and resource registration
Fix jsonschema struct tags that used unsupported `WORD=` prefix syntax
(e.g. `description=...`, `default=...`, `enum=...`). The google/jsonschema-go
library treats the tag value as a plain description string and rejects
tags beginning with `WORD=`.
Add server_test.go that uses the SDK in-memory transport to verify:
- All 54 tools are registered (52 workflow + 1 generic + 1 raw JNI)
- The jni://services static resource is listed
- Reading jni://services returns valid JSON with service names
TriggerMillisint64`json:"trigger_millis" jsonschema:"description=Trigger time in milliseconds (RTC types: epoch millis; ELAPSED types: millis since boot)"`
TriggerMillisint64`json:"trigger_millis" jsonschema:"Trigger time in milliseconds (RTC types: epoch millis; ELAPSED types: millis since boot)"`
1403
1403
}
1404
1404
1405
1405
typegetNextAlarmInputstruct{}
@@ -1410,8 +1410,8 @@ type getNextAlarmOutput struct {
1410
1410
}
1411
1411
1412
1412
typemanageJobsInputstruct {
1413
-
Actionstring`json:"action" jsonschema:"enum=list,enum=cancel,enum=cancel_all,description=Action to perform: list pending jobs, cancel a specific job by ID, or cancel all jobs"`
1414
-
JobIDint32`json:"job_id,omitempty" jsonschema:"description=Job ID for cancel action (ignored for list and cancel_all)"`
1413
+
Actionstring`json:"action" jsonschema:"Action to perform: list pending jobs, cancel a specific job by ID, or cancel all jobs (valid: list, cancel, cancel_all)"`
1414
+
JobIDint32`json:"job_id,omitempty" jsonschema:"Job ID for cancel action (ignored for list and cancel_all)"`
1415
1415
}
1416
1416
1417
1417
func (s*Server) registerSchedulingTools() {
@@ -1712,8 +1712,8 @@ type getInputMethodsOutput struct {
1712
1712
}
1713
1713
1714
1714
typetoggleKeyboardInputstruct {
1715
-
ShowFlagsint32`json:"show_flags" jsonschema:"default=0,description=Show flags for ToggleSoftInput: 0=implicit 1=forced 2=not_always"`
1716
-
HideFlagsint32`json:"hide_flags" jsonschema:"default=0,description=Hide flags for ToggleSoftInput: 0=implicit 1=not_always"`
1715
+
ShowFlagsint32`json:"show_flags" jsonschema:"Show flags for ToggleSoftInput: 0=implicit 1=forced 2=not_always (default: 0)"`
1716
+
HideFlagsint32`json:"hide_flags" jsonschema:"Hide flags for ToggleSoftInput: 0=implicit 1=not_always (default: 0)"`
1717
1717
}
1718
1718
1719
1719
func (s*Server) registerInputTools() {
@@ -1990,8 +1990,8 @@ func (s *Server) registerStorageTools() {
1990
1990
1991
1991
// manage_downloads — mutation
1992
1992
typedownloadInputstruct {
1993
-
Actionstring`json:"action" jsonschema:"enum=get_mime_type,enum=remove,description=Action to perform: get_mime_type or remove"`
1994
-
DownloadIDint64`json:"download_id" jsonschema:"description=Download ID to operate on"`
1993
+
Actionstring`json:"action" jsonschema:"Action to perform: get_mime_type or remove (valid: get_mime_type, remove)"`
1994
+
DownloadIDint64`json:"download_id" jsonschema:"Download ID to operate on"`
1995
1995
}
1996
1996
gomcp.AddTool(s.mcp, &gomcp.Tool{
1997
1997
Name: "manage_downloads",
@@ -2045,7 +2045,7 @@ func (s *Server) registerStorageTools() {
2045
2045
func (s*Server) registerAppsTools() {
2046
2046
// get_app_usage — read-only
2047
2047
typeappUsageInputstruct {
2048
-
PackageNamestring`json:"package_name,omitempty" jsonschema:"description=Package name to check inactivity for (optional)"`
2048
+
PackageNamestring`json:"package_name,omitempty" jsonschema:"Package name to check inactivity for (optional)"`
2049
2049
}
2050
2050
typeappUsageOutputstruct {
2051
2051
StandbyBucketint32`json:"standby_bucket"`
@@ -2086,7 +2086,7 @@ func (s *Server) registerAppsTools() {
2086
2086
2087
2087
// check_permissions — read-only
2088
2088
typecheckPermInputstruct {
2089
-
RoleNamestring`json:"role_name" jsonschema:"description=Android role name to check (e.g. android.app.role.DIALER, android.app.role.SMS, android.app.role.BROWSER)"`
2089
+
RoleNamestring`json:"role_name" jsonschema:"Android role name to check (e.g. android.app.role.DIALER, android.app.role.SMS, android.app.role.BROWSER)"`
2090
2090
}
2091
2091
typecheckPermOutputstruct {
2092
2092
RoleNamestring`json:"role_name"`
@@ -2130,7 +2130,7 @@ func (s *Server) registerAppsTools() {
2130
2130
func (s*Server) registerAccountsTools() {
2131
2131
// list_accounts — read-only
2132
2132
typelistAccountsInputstruct {
2133
-
AccountTypestring`json:"account_type,omitempty" jsonschema:"description=Optional account type filter (e.g. com.google). If empty returns all accounts."`
2133
+
AccountTypestring`json:"account_type,omitempty" jsonschema:"Optional account type filter (e.g. com.google). If empty returns all accounts."`
2134
2134
}
2135
2135
typelistAccountsOutputstruct {
2136
2136
AccountsHandleint64`json:"accounts_handle"`
@@ -2181,9 +2181,9 @@ func (s *Server) registerAccountsTools() {
2181
2181
func (s*Server) registerCompanionTools() {
2182
2182
// manage_companions — read for list, mutation for disassociate
2183
2183
typecompanionInputstruct {
2184
-
Actionstring`json:"action" jsonschema:"enum=list,enum=disassociate,description=Action: list (get associations) or disassociate (remove by device ID)"`
2185
-
DeviceIDint32`json:"device_id,omitempty" jsonschema:"description=Association ID for disassociate action"`
2186
-
MacAddressstring`json:"mac_address,omitempty" jsonschema:"description=MAC address string for disassociate action (alternative to device_id)"`
2184
+
Actionstring`json:"action" jsonschema:"Action: list (get associations) or disassociate (remove by device ID) (valid: list, disassociate)"`
2185
+
DeviceIDint32`json:"device_id,omitempty" jsonschema:"Association ID for disassociate action"`
2186
+
MacAddressstring`json:"mac_address,omitempty" jsonschema:"MAC address string for disassociate action (alternative to device_id)"`
2187
2187
}
2188
2188
gomcp.AddTool(s.mcp, &gomcp.Tool{
2189
2189
Name: "manage_companions",
@@ -2247,8 +2247,8 @@ func (s *Server) registerCompanionTools() {
2247
2247
func (s*Server) registerSettingsTools() {
2248
2248
// get_settings — stub
2249
2249
typegetSettingsInputstruct {
2250
-
Namespacestring`json:"namespace" jsonschema:"enum=system,enum=secure,enum=global,description=Settings namespace: system, secure, or global"`
2251
-
Namestring`json:"name" jsonschema:"description=Setting name (e.g. screen_brightness, screen_off_timeout)"`
2250
+
Namespacestring`json:"namespace" jsonschema:"Settings namespace: system,secure, or global (valid: system, secure, global)"`
2251
+
Namestring`json:"name" jsonschema:"Setting name (e.g. screen_brightness, screen_off_timeout)"`
2252
2252
}
2253
2253
gomcp.AddTool(s.mcp, &gomcp.Tool{
2254
2254
Name: "get_settings",
@@ -2275,9 +2275,9 @@ func (s *Server) registerSettingsTools() {
2275
2275
2276
2276
// set_settings — stub
2277
2277
typesetSettingsInputstruct {
2278
-
Namespacestring`json:"namespace" jsonschema:"enum=system,enum=secure,enum=global,description=Settings namespace: system, secure, or global"`
Actionstring`json:"action" jsonschema:"enum=status,enum=enable,enum=disable,enum=start_discovery,enum=cancel_discovery,description=Bluetooth action to perform"`
2350
+
Actionstring`json:"action" jsonschema:"Bluetooth action to perform (valid: status,enable,disable,start_discovery, cancel_discovery)"`
2351
2351
}
2352
2352
gomcp.AddTool(s.mcp, &gomcp.Tool{
2353
2353
Name: "bluetooth",
@@ -2441,10 +2441,10 @@ func (s *Server) registerPrintTools() {
2441
2441
func (s*Server) registerPowerTools() {
2442
2442
// set_power_mode — combined power query and wake lock stub
2443
2443
typepowerInputstruct {
2444
-
Actionstring`json:"action" jsonschema:"enum=status,enum=new_wake_lock,description=Action: status (query power state) or new_wake_lock (create wake lock)"`
0 commit comments