getRegisteredToolFields
List<
Returns the field names exposed in the Zod input schema for a registered tool. This is what MCP clients see when inspecting a tool's parameters. Returns an empty list if the tool is not found or has no schema fields.
Implementation
List<String> getRegisteredToolFields(String toolName) {
try {
final registeredTools = _mcpServer['_registeredTools'] as JSObject?;
if (registeredTools == null) return [];
final tool = registeredTools[toolName] as JSObject?;
if (tool == null) return [];
final inputSchema = tool['inputSchema'] as JSObject?;
if (inputSchema == null) return [];
final shape = inputSchema['shape'] as JSObject?;
if (shape == null) return [];
final keys = _jsObjectKeys(shape);
return [for (var i = 0; i < keys.length; i++) keys[i].toDart];
} catch (_) {
return [];
}
}