Skip to main content
Glama

get-signal

Retrieve all occurrences of a signal in a VCD file. Specify file, signal name, and optional time range.

Instructions

Get all instances of a specified signal in a VCD file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_nameYesName of the VCD file to analyze
signal_nameYesName of the signal to search for
start_timeNoStart timestamp (optional)
end_timeNoEnd timestamp (optional)

Implementation Reference

  • The actual handler for the 'get-signal' tool. It extracts arguments, looks up the signal character from cached mappings, and calls get_signal_lines() to retrieve matching lines from the VCD file.
    if name == "get-signal":
        file_name = arguments.get("file_name")
        signal_name = arguments.get("signal_name")
        start_time = arguments.get("start_time")
        end_time = arguments.get("end_time")
    
        if not file_name or not signal_name:
            raise ValueError("Missing required parameters")
    
        try:
            # Get or update signal mappings for this file
            if file_name not in signal_mappings:
                signal_mappings[file_name] = await parse_signal_mappings(file_name)
    
            # Look up the character for this signal
            signal_char = signal_mappings[file_name].get(signal_name)
            if not signal_char:
                return [types.TextContent(
                    type="text",
                    text=f"Signal '{signal_name}' not found in VCD file"
                )]
    
            # Get all lines containing this character within time range
            output = await get_signal_lines(file_name, signal_char, start_time, end_time)
    
            return [types.TextContent(
                type="text",
                text=output if output else "No match"
            )]
    
        except Exception as e:
            return [types.TextContent(
                type="text",
                text=str(e)
            )]
  • The tool registration via @server.list_tools() decorator. Defines the 'get-signal' tool name, description, and input JSON schema with required parameters (file_name, signal_name) and optional (start_time, end_time).
    @server.list_tools()
    async def handle_list_tools() -> list[types.Tool]:
        """
        List available tools.
        Each tool specifies its arguments using JSON Schema validation.
        """
        return [
            types.Tool(
                name="get-signal",
                description="Get all instances of a specified signal in a VCD file",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "file_name": {
                            "type": "string",
                            "description": "Name of the VCD file to analyze",
                        },
                        "signal_name": {
                            "type": "string",
                            "description": "Name of the signal to search for",
                        },
                        "start_time": {
                            "type": "integer",
                            "description": "Start timestamp (optional)",
                        },
                        "end_time": {
                            "type": "integer",
                            "description": "End timestamp (optional)",
                        },
                    },
                    "required": ["file_name", "signal_name"],
                },
            ),
        ]
  • JSON Schema input definition for the 'get-signal' tool, specifying file_name (string), signal_name (string), start_time (integer, optional), and end_time (integer, optional).
    inputSchema={
        "type": "object",
        "properties": {
            "file_name": {
                "type": "string",
                "description": "Name of the VCD file to analyze",
            },
            "signal_name": {
                "type": "string",
                "description": "Name of the signal to search for",
            },
            "start_time": {
                "type": "integer",
                "description": "Start timestamp (optional)",
            },
            "end_time": {
                "type": "integer",
                "description": "End timestamp (optional)",
            },
        },
        "required": ["file_name", "signal_name"],
    },
  • Helper function that parses a VCD file to build a mapping from signal names to their character identifiers (used to look up signal data).
    async def parse_signal_mappings(file_name: str) -> Dict[str, str]:
        """Parse VCD file to extract signal name to character mappings."""
        mappings = {}
        try:
            with open(file_name, 'r') as f:
                for line in f:
                    if line.startswith('$enddefinitions'):
                        break
                    if line.startswith('$var'):
                        parts = line.split()
                        if len(parts) >= 5:
                            char, signal = parts[3], parts[4]
                            mappings[signal] = char
            return mappings
        except Exception as e:
            raise RuntimeError(f"Failed to parse signal mappings: {str(e)}")
  • Helper function that reads VCD file lines matching a given character within an optional time range, returning formatted 'line_number:content' matches.
    async def get_signal_lines(file_name: str, char: str, start_time: Optional[int] = None, end_time: Optional[int] = None) -> str:
        """Get all lines containing the specified character within the timestamp range."""
        try:
            matches = []
            current_time = 0
            with open(file_name, 'r') as f:
                for line_num, line in enumerate(f, 1):
                    line = line.rstrip()
    
                    # Update current timestamp if we see a timestamp marker
                    if line.startswith('#'):
                        try:
                            current_time = int(line[1:])
                        except ValueError:
                            continue
    
                    # Skip if we're before start_time
                    if start_time is not None and current_time < start_time:
                        continue
    
                    # Break if we're past end_time
                    if end_time is not None and current_time > end_time:
                        break
    
                    # If we're in the desired time range and line contains our character
                    if char in line:
                        matches.append(f"{line_num}:{line}")
    
            return '\n'.join(matches)
        except Exception as e:
            raise RuntimeError(f"Failed to read file: {str(e)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears full responsibility for behavioral disclosure. It only indicates a read operation ('Get') without mentioning side effects, error conditions, or performance implications. The description is insufficiently transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 11 words, highly concise and front-loaded with the core action. No extraneous information is present.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, and the description does not explain what an 'instance' constitutes (e.g., time, value). For a tool with 4 parameters and no output schema, the description is inadequate for complete understanding of the return format.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, meaning all parameters are described in the input schema. The tool description does not add any additional semantic value beyond what the schema already provides, meeting the baseline for this dimension.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'all instances of a specified signal in a VCD file', making the tool's purpose specific and unambiguous. No siblings exist, so differentiation is unnecessary.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

With no sibling tools, usage guidelines are less critical, but the description provides no explicit context, prerequisites, or when-to-use advice. It implicitly suggests analyzing VCD files but lacks definitive guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SeanMcLoughlin/mcp-vcd'

If you have feedback or need assistance with the MCP directory API, please join our Discord server