Skip to main content
Glama

list_variables

Retrieve and display all variables in the current Python REPL session for easy tracking and management of your workspace environment.

Instructions

List all variables in the current session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler implementation for the 'list_variables' tool. It filters the global namespace to exclude builtins and private variables, formats them as a list, and returns as text content.
    elif name == "list_variables": # Filter out builtins and private variables vars_dict = { k: repr(v) for k, v in self.global_namespace.items() if not k.startswith('_') and k != '__builtins__' } if not vars_dict: return [ types.TextContent( type="text", text="No variables in current session." ) ] # Format variables list var_list = "\n".join(f"{k} = {v}" for k, v in vars_dict.items()) return [ types.TextContent( type="text", text=f"Current session variables:\n\n{var_list}" ) ]
  • Registration of the 'list_variables' tool in the list_tools handler, including its name, description, and empty input schema.
    types.Tool( name="list_variables", description="List all variables in the current session", inputSchema={ "type": "object", "properties": {}, }, ),
  • Input schema definition for the 'list_variables' tool, which requires no parameters.
    inputSchema={ "type": "object", "properties": {}, },

Other Tools

Related 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/hdresearch/mcp-python'

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