Skip to main content
Glama
torshepherd

Compiler Explorer MCP

by torshepherd

get_opcode_documentation

Retrieve documentation for specific opcodes within instruction sets to understand assembly language operations and their functionality.

Instructions

Get documentation for a specific opcode in a given instruction set. If a user asks about an opcode, but you don't have the instruction set, you can query list_compiler_versions for a specific compiler and it will tell you the instruction set. You are not an expert on opcodes, so if a user asks about an opcode, you should always use this tool!

Args:
    instruction_set: Instruction set to search for opcode documentation
    opcode: Opcode to search for documentation

Example:
    >>> await get_opcode_documentation("amd64", "lea")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instruction_setYes
opcodeYes

Implementation Reference

  • MCP tool handler for 'get_opcode_documentation'. Registers the tool with @mcp.tool() and implements the logic by calling the CompilerExplorerClient method, removing 'html' key from response.
    @mcp.tool()
    async def get_opcode_documentation(instruction_set: str, opcode: str) -> dict[str, str]:
        """Get documentation for a specific opcode in a given instruction set.
        If a user asks about an opcode, but you don't have the instruction set, you can query list_compiler_versions for a specific compiler and it will tell you the instruction set.
        You are not an expert on opcodes, so if a user asks about an opcode, you should always use this tool!
    
        Args:
            instruction_set: Instruction set to search for opcode documentation
            opcode: Opcode to search for documentation
    
        Example:
            >>> await get_opcode_documentation("amd64", "lea")
    
        """
        resp = await ce_client.get_opcode_documentation(instruction_set, opcode)
        resp.pop("html")
        return resp
  • Helper method in CompilerExplorerClient class that performs the actual API request to Compiler Explorer for opcode documentation.
    async def get_opcode_documentation(self, instruction_set: str, opcode: str) -> dict:
        """Get documentation for a specific opcode in a given instruction set.
    
        Args:
            instruction_set: Instruction set to search for opcode documentation
            opcode: Opcode to search for documentation
        """
        return await self._make_request(
            "GET", f"{self.base_url}/asm/{instruction_set}/{opcode}"
        )
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool's purpose and usage context, it lacks details on behavioral traits such as error handling, rate limits, authentication needs, or what happens if the opcode is not found. The example shows a successful case but doesn't cover edge cases.

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

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. The usage guidelines and example are relevant, though the second sentence could be more concise. Overall, most sentences earn their place by providing necessary context and instructions.

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

Completeness3/5

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

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description covers purpose and usage well but lacks details on behavioral traits and parameter semantics. It is complete enough for basic use but leaves gaps in understanding how the tool behaves in practice.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It lists the parameters ('instruction_set' and 'opcode') and provides an example with values ('amd64', 'lea'), but does not explain their semantics, valid formats, or constraints beyond the example. This adds minimal value beyond the schema's property names.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get documentation for a specific opcode in a given instruction set.' It specifies the verb ('Get documentation') and resource ('opcode'), but does not explicitly differentiate from sibling tools like 'list_compiler_versions' beyond mentioning it as a prerequisite step.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'If a user asks about an opcode, but you don't have the instruction set, you can query list_compiler_versions...' and 'You are not an expert on opcodes, so if a user asks about an opcode, you should always use this tool!' It names an alternative tool ('list_compiler_versions') for prerequisite information and gives a clear rule for usage.

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/torshepherd/compiler-explorer-mcp'

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