LLM Optimization Tools
Overview
The PyWellen MCP server includes specialized tools designed to optimize interaction with Large Language Models (LLMs). These tools provide:
Natural language query interpretation
Context-efficient signal summaries
Signal relationship recommendations
Educational documentation and guidance
These tools help reduce token usage, improve response quality, and make waveform analysis more accessible to LLMs.
Tools
query_natural_language
Purpose: Interpret natural language queries and suggest appropriate tool calls.
Use Case: When user queries are ambiguous or exploratory, use this tool to map intent to specific MCP operations.
Parameters:
session_id(string, required): Active waveform session IDquery(string, required): Natural language querymax_results(integer, optional): Maximum suggestions to return (default: 10)
Returns:
interpreted_intent: What the user is trying to accomplishsuggested_tools: List of tool calls with parametersreasoning: Explanation of why these tools were chosenexample_usage: How to execute the suggestions
Example Usage:
{
"session_id": "abc123",
"query": "show me all clock signals"
}
Example Response:
{
"interpreted_intent": "Find clock signals",
"suggested_tools": [
{
"tool": "search_by_activity",
"parameters": {
"session_id": "abc123",
"min_toggles": 100
},
"priority": "high"
},
{
"tool": "hierarchy_search",
"parameters": {
"session_id": "abc123",
"pattern": "clk",
"case_sensitive": false
},
"priority": "medium"
}
],
"reasoning": [
"High-activity signals likely to be clocks",
"Signal names containing 'clk' likely to be clocks"
]
}
Common Query Patterns:
“show me all clock signals” →
search_by_activity+hierarchy_search“find reset signals” →
hierarchy_searchwith pattern “reset|rst”“what caused signal X to change” →
debug_trace_causality“compare signal A and B” →
signal_compare“find rising edges” →
debug_find_transitionwith condition=”rises”“show timeline of events” →
debug_event_timeline
signal_summarize
Purpose: Generate concise summaries of signal behavior instead of returning raw data.
Use Case: Use this instead of signal_list_changes when you need high-level understanding without consuming excessive tokens.
Parameters:
session_id(string, required): Active waveform session IDvariable_path(string, required): Signal path (e.g., “top.cpu.state”)max_changes(integer, optional): Maximum representative changes (default: 20)include_stats(boolean, optional): Include statistical analysis (default: true)
Returns:
signal_name: Signal pathsummary: One-line description of behaviortotal_changes: Total number of transitionsstatistics: Toggle count, value range, activity metricsrepresentative_changes: Key transitions (sampled, not exhaustive)patterns: Detected patterns (periodic, constant, high_activity, etc.)recommendations: Suggested next steps for analysis
Example Usage:
{
"session_id": "abc123",
"variable_path": "top.clk"
}
Example Response:
{
"signal_name": "top.clk",
"summary": "Signal 'top.clk' has 1000 transitions, periodic with period ~10.0 time units, 1000 toggles (likely a clock signal)",
"total_changes": 1000,
"statistics": {
"toggle_count": 1000,
"toggle_rate": 0.5,
"unique_values": 2,
"period": 10.0
},
"patterns": ["periodic", "binary_toggle", "high_activity", "likely_clock"],
"recommendations": [
"Use this signal for temporal reference",
"Consider using debug_event_timeline with this clock"
],
"truncated": true
}
Detected Patterns:
constant: Signal never changessingle_transition: Only one changelow_activity: Fewer than 5 changeshigh_activity: High toggle rate (> 0.1)periodic: Regular interval between changesbinary_toggle: Only toggles between two valueslikely_clock: High activity + periodic pattern
docs_get_started
Purpose: Get quick-start guide for using the PyWellen MCP server.
Use Case: When an LLM needs to understand available capabilities and common workflows.
Parameters: None
Returns:
overview: Brief description of the serverquick_start: Step-by-step getting started guidecommon_workflows: Example task sequencestool_categories: Tools organized by purposetips: Best practices for LLM interaction
Common Workflows:
Debugging:
Open waveform with
waveform_openFind error signal with
hierarchy_searchGet value at failure time with
signal_get_valueTrace causes with
debug_trace_causalityBuild timeline with
debug_event_timeline
Clock Analysis:
Find clocks with
search_by_activity(high toggles)Or search with
hierarchy_searchpattern=’clk’Summarize behavior with
signal_summarizeFind edges with
debug_find_transitioncondition=’rises’
Signal Comparison:
Find signals with
hierarchy_searchCompare with
signal_compareGet specific values if differences found
Build event timeline for both signals
Design Exploration:
Get metadata with
waveform_infoList top scopes with
hierarchy_list_top_scopesDrill down with
hierarchy_get_scopeList variables with
hierarchy_list_variablesUse
recommend_related_signalsfor discovery
docs_tool_guide
Purpose: Get detailed usage guide for a specific tool.
Use Case: When an LLM needs in-depth documentation for how to use a particular tool.
Parameters:
tool_name(string, required): Name of tool to document
Returns:
tool_name: Name of the tooldescription: What the tool doesparameters: Detailed parameter descriptionsreturns: What the tool returnsexamples: Usage examplesrelated_tools: Other tools commonly used with this onecommon_errors: Typical errors and solutions
Example Usage:
{
"tool_name": "signal_get_value"
}
Documented Tools: waveform_open, signal_get_value, debug_trace_causality, signal_summarize
Best Practices
Token Efficiency
Use signal_summarize instead of signal_list_changes for high-level understanding
Use query_natural_language to interpret ambiguous user requests
Use recommend_related_signals to discover signals without listing all
Limit max_results parameters to reduce response size
Query Interpretation Patterns
When users ask:
“Show me…” → Use
hierarchy_searchorhierarchy_list_variables“What caused…” → Use
debug_trace_causality“Compare…” → Use
signal_compare“Find edges/transitions…” → Use
debug_find_transition“Timeline…” → Use
debug_event_timeline“Active signals…” → Use
search_by_activity
Context Window Management
Start with summaries, drill down to details only if needed
Use pagination (limit/offset) for large result sets
Truncate long outputs with max_results parameters
Group related operations in single requests
Close sessions when done to free resources
Integration with Workflows
Natural Language → Tool Mapping:
Receive user’s natural language request
Call
query_natural_languageto interpret intentReview suggested tools and parameters
Execute the suggested tool calls
Present results to user in natural language
Limitations
query_natural_languageuses heuristics, not full NLPParameter extraction (e.g., signal names, times) must be done by calling LLM
Signal pattern detection is based on simple statistics, not deep analysis
Complementary signal suggestions are based on naming conventions
See Also
hierarchy_navigation - For exploring design structure
signal_analysis - For detailed signal queries
debugging_tools - For debugging workflows
api_reference - Complete API documentation