WPF application inspector and controller via Model Context Protocol. Enables remote inspection of WPF UI elements, visual tree traversal, element property inspection, automation peer interaction, and screenshot capture of running WPF applications.
Static source inference · medium confidence · detected: Logging
Deprecated protocol patterns detected
Summary
SnoopWpf MCP Server provides 6 tools for WPF process inspection and automation. Tool definitions are present with basic naming and descriptions, but quality gaps are significant. Naming convention is inconsistent (verb_noun mostly followed, but 'execute_automation_peer_command' and 'get_automation_peer_info' are verbose). Descriptions are present but generic, most lack context about WHEN to use the tool or what distinguishes it from similar tools. Parameter descriptions are minimal (1-6 words each). No output schemas are documented in the source code, the server returns results via SemanticKernel invocation but does not formally declare the shape of return values. Error handling is absent from the visible code; tool definitions do not guide recovery or categorize errors. Security consideration: process injection and UI automation carry risk; no permission checks, audit logging, or input validation visible in the definitions themselves. The server does register tools with SemanticKernel and exposes schemas via the kernel's metadata API, but those schemas are auto-generated from parameter reflection, output structure is not explicitly specified. Compared to production baselines (avg tool description 194 chars, avg params 4), this server has short descriptions (15-100 chars) and 0-5 parameters per tool.
Tools (6)
execute_automation_peer_commandwrite43/100
Execute an automation peer command on a UI element to perform actions like invoke, set value, toggle, expand/collapse, or scroll
get_automation_peer_inforead only48/100
Get automation peer information for a UI element, including supported automation patterns and actions
get_element_inforead only50/100
Get detailed information about a specific UI element including its properties, type, and data context
get_visual_treeread only50/100
Get the complete visual tree structure of a WPF application as JSON, including all UI elements and their hierarchy
list_wpf_processesread only50/100
List all running WPF processes with metadata including process ID, name, window title, and file path
take_screenshotread only50/100
Take a screenshot of a WPF application window and return it as base64-encoded image data
Output schemas not documented. Return types and field structures are not formally declared for any tool. Agents cannot infer what data is available after each call, forcing ad-hoc parsing and error-prone downstream reasoning.
Destructive tool (execute_automation_peer_command) lacks confirmation/dry-run capability and permission checks. Tool description does not acknowledge side effects or guide recovery if action fails. Violates pattern:confirmation-request and pattern:permission-gate for irreversible operations.
Parameter descriptions are minimal (1-6 words). Agent cannot understand parameter semantics, constraints, or how to obtain values (e.g., where does 'hashcode' come from?). Implicit dependencies between tools are not documented.
Recommendations
Document output schemas for all tools. For list_wpf_processes, specify: returns array of {processId: integer, name: string, windowTitle: string, filePath: string}. For get_visual_tree, specify the tree node structure (name, type, properties, children array). For get_element_info, specify returned properties and their types. Add these to tool descriptions or a separate schema reference.
Add confirmation/dry-run capability to execute_automation_peer_command. Proposal: add optional parameter 'dryRun: boolean' (default false) to preview the action before executing. Update description to: 'Execute an automation peer command on a UI element. Set dryRun=true to preview the action without side effects. Supported actions: Invoke_Invoke, Value_Set, Toggle_Toggle, ExpandCollapse_Expand, ExpandCollapse_Collapse, Scroll_Up, Scroll_Down. Action is DESTRUCTIVE and may modify application state.' Include guidance: 'If you cannot undo the action, set dryRun=true first.'
Expand parameter descriptions. For processId: 'Process ID (integer) of the target WPF application. Obtain from list_wpf_processes.' For hashcode: 'Hashcode (integer) of the target UI element. Obtain from get_visual_tree.' For action: 'Action to execute on the element. Must be one of: Invoke_Invoke (click button), Value_Set (set text field), Toggle_Toggle (toggle checkbox), ExpandCollapse_Expand, ExpandCollapse_Collapse (tree nodes), Scroll_Up, Scroll_Down.' Convert action to enum if possible.
Enhance tool descriptions by 2-3x. Example for get_visual_tree: 'Retrieve the complete visual tree structure of a WPF application, including all UI elements, their types, properties, and hierarchy. Call this first to discover element IDs (hashcodes) for use with get_element_info and execute_automation_peer_command. Returns a tree structure; large trees may be truncated to 1000 nodes. If the process is not running or not a WPF app, returns an error.' Length target: 150-250 chars.
Spec posture evidence
Inferred effective spec: <=2025-11-25.
Relies on Logging (deprecated) - log to stderr or use OpenTelemetry
Tool descriptions are generic and lack context. No guidance on WHEN to use each tool, what distinguishes it from similar tools, or dependencies on other tools. Descriptions do not answer 'what does it do?' + 'when should LLM call it instead of a similar tool?' + 'what does it return?'
No error handling or recovery guidance visible in tool definitions. If a process is not found, if an element is invalid, or if an automation action fails, tool definitions do not explain what the agent should do next. Violations of pattern:recovery-guide and pattern:error-classification.
Tool naming inconsistency and verbosity. 'execute_automation_peer_command' (38 chars) and 'get_automation_peer_info' (24 chars) are verbose and generic. Should follow verb_noun pattern more strictly (e.g., 'invoke_ui_action', 'list_element_actions').
No input validation or constraint documentation. 'processId' parameter has no range or validation rules. 'action' parameter is free-form string (not an enum), yet description lists specific valid actions. Should declare action as an enum to prevent hallucinated invalid actions. Violates pattern:constrained-input.
No audit logging, permission checks, or security scoping documented. Process injection and UI automation are sensitive operations that should be logged and access-controlled. Tool definitions do not declare required permissions or mention logging. Violates pattern:audit-trail and pattern:scope-declaration.
Add inter-tool dependency hints. In get_visual_tree description: 'Call this first to obtain element hashcodes needed for get_element_info and execute_automation_peer_command.' In execute_automation_peer_command description: 'To discover available actions for an element, call get_automation_peer_info first. To inspect the element before acting, call get_element_info.'
Implement and document error recovery guidance. For all tools, add to description: 'If the process is not found or closed, check list_wpf_processes first. If an element hashcode is invalid, call get_visual_tree to refresh the tree.' For execute_automation_peer_command: 'If the action is not supported by the element, call get_automation_peer_info to see which actions are available.'
Rename verbose/generic tools. 'execute_automation_peer_command' → 'invoke_ui_action' or 'automate_element'. 'get_automation_peer_info' → 'list_element_actions'. Align with verb_noun pattern and production baselines (avg 18 chars).
Convert free-form string parameters to enums where possible. action parameter in execute_automation_peer_command should be declared as enum: ['Invoke_Invoke', 'Value_Set', 'Toggle_Toggle', 'ExpandCollapse_Expand', 'ExpandCollapse_Collapse', ...]. This prevents hallucinated invalid actions and makes the schema self-documenting.
Document security and audit expectations. Add to server initialization or per-tool: 'All WPF inspection and automation calls are logged with: caller identity, process ID, element hashcode, action type, timestamp, success/failure. Destructive actions (execute_automation_peer_command) require audit trail confirmation. Consider implementing rate limits to prevent runaway automation loops.' Add tool annotation hints (destructiveHint=true for execute_automation_peer_command, readOnlyHint=true for others).
Add result limits and pagination guidance. For list_wpf_processes: 'Returns list of all running WPF processes. If more than 100 processes, consider filtering by name pattern (future enhancement).' For get_visual_tree: 'Tree may be large; if truncated, a note is included indicating full tree size. Consider calling get_element_info on specific elements instead of fetching the entire tree.' Prevents context window exhaustion.