Skip to main content
Glama
opensensor

Binary Ninja Cline MCP Server

by opensensor

list_functions

Extract and display function names from binary files to analyze program structure and identify key components.

Instructions

List functions in a binary

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • MCP CallToolRequest handler case for list_functions tool: parses input arguments using FilePathSchema and calls the Binary Ninja HTTP server.
    case "list_functions": {
      try {
        const args = FilePathSchema.parse(request.params.arguments);
        result = await callBinaryNinjaServer("list_functions", args);
      } catch (error) {
        console.error(`[ERROR] Failed to parse arguments for list_functions: ${error.message}`);
        console.error(`[ERROR] Arguments received: ${JSON.stringify(request.params.arguments)}`);
        throw error;
      }
      break;
  • Tool registration entry in ListTools response: defines name, description, and inputSchema for list_functions.
      name: "list_functions",
      description: "List functions in a binary",
      inputSchema: zodToJsonSchema(FilePathSchema),
    },
  • Zod schema defining the input parameters for list_functions tool: requires a non-empty 'path' string.
    const FilePathSchema = z.object({
      path: z.string().min(1, "File path cannot be empty")
    });
  • Intermediate HTTP server handler for list_functions method: extracts path param, calls BinaryNinjaHTTPClient.list_functions, extracts and returns function names.
    elif method == "list_functions":
        path = params.get("path")
        if not path:
            return {"error": "Path parameter is required"}
            
        functions = client.list_functions(path)
        func_names = [f["name"] for f in functions]
        return {"result": func_names}
  • Core implementation: paginates requests to Binary Ninja HTTP API /functions endpoint (offset/limit) to retrieve all functions from the loaded binary.
    def list_functions(self, file_path=None):
        """List all functions in the currently open binary file."""
        try:
            # Get all functions with pagination
            all_functions = []
            offset = 0
            limit = 100
            
            while True:
                response = self._request('GET', 'functions', params={"offset": offset, "limit": limit})
                functions = response.get("functions", [])
                
                if not functions:
                    break
                    
                all_functions.extend(functions)
                
                # If we got fewer functions than the limit, we've reached the end
                if len(functions) < limit:
                    break
                    
                # Move to the next page
                offset += limit
                
            logger.info(f"Retrieved {len(all_functions)} functions in total")
            return all_functions
        except Exception as e:
            logger.error(f"Failed to list functions: {e}")
            raise

Tool Definition Quality

Score is being calculated. Check back soon.

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/opensensor/bn_cline_mcp'

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