Skip to main content
Glama

list_variables

View all variables currently defined in the Python REPL session to track and manage your workspace.

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 and lists variables from the global namespace, excluding builtins and private variables, formatting them for output.
    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 for the 'list_variables' tool, which requires no parameters.
    inputSchema={ "type": "object", "properties": {}, },

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