skill_env_crud
Manage environment variables for skills by reading keys, setting values, deleting entries, or clearing all variables through unified CRUD operations.
Instructions
Unified CRUD tool for skill environment variable operations. Supports single and bulk operations.
Operations:
read: Read all environment variable keys (values are hidden for security)
set: Set one or more environment variables (merges with existing)
delete: Delete one or more environment variables
clear: Clear all environment variables
Examples:
Note: The 'set' operation always merges with existing variables. To replace everything, use 'clear' first, then 'set'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | Yes | Operation to perform: 'read', 'set', 'delete', 'clear' | |
| skill_name | Yes | Name of the skill | |
| variables | No | Variables to set (key-value pairs for 'set' operation) | |
| keys | No | Variable keys to delete (for 'delete' operation) |
Implementation Reference
- Main handler function for the skill_env_crud tool. Dispatches CRUD operations (read, set, delete, clear) to private helper methods.@staticmethod async def skill_env_crud(input_data: SkillEnvCrudInput) -> list[types.TextContent]: """Handle environment variable CRUD operations.""" operation = input_data.operation try: if operation == "read": return await SkillEnvCrud._handle_read(input_data) elif operation == "set": return await SkillEnvCrud._handle_set(input_data) elif operation == "delete": return await SkillEnvCrud._handle_delete(input_data) elif operation == "clear": return await SkillEnvCrud._handle_clear(input_data) else: return [ types.TextContent( type="text", text=f"Unknown operation: {operation}. Valid operations: read, set, delete, clear", ) ] except Exception as e: return [types.TextContent(type="text", text=f"Error: {str(e)}")]
- src/skill_mcp/models_crud.py:68-83 (schema)Pydantic BaseModel defining the input schema for the skill_env_crud tool, including operation, skill_name, variables, and keys.class SkillEnvCrudInput(BaseModel): """Unified input for skill environment variable CRUD operations.""" operation: str = Field(description="Operation to perform: 'read', 'set', 'delete', 'clear'") skill_name: str = Field(description="Name of the skill") # Set operations (single or bulk) variables: Optional[Dict[str, str]] = Field( default=None, description="Variables to set (key-value pairs for 'set' operation)" ) # Delete operations (single or bulk) keys: Optional[List[str]] = Field( default=None, description="Variable keys to delete (for 'delete' operation)" )
- src/skill_mcp/server.py:30-38 (registration)MCP server tool listing handler that registers the skill_env_crud tool by including SkillEnvCrud.get_tool_definition().@app.list_tools() # type: ignore[misc] async def list_tools() -> list[types.Tool]: """List available tools.""" tools = [] tools.extend(SkillCrud.get_tool_definition()) tools.extend(SkillFilesCrud.get_tool_definition()) tools.extend(SkillEnvCrud.get_tool_definition()) tools.extend(ScriptTools.get_script_tools()) return tools
- src/skill_mcp/server.py:52-54 (registration)Dispatch registration in MCP server's call_tool handler for invoking the skill_env_crud tool.elif name == "skill_env_crud": env_input = SkillEnvCrudInput(**arguments) return await SkillEnvCrud.skill_env_crud(env_input)
- Tool definition method providing the Tool object with name, description, and inputSchema reference for registration in list_tools.@staticmethod def get_tool_definition() -> list[types.Tool]: """Get tool definition.""" return [ types.Tool( name="skill_env_crud", description="""Unified CRUD tool for skill environment variable operations. Supports single and bulk operations. **Operations:** - **read**: Read all environment variable keys (values are hidden for security) - **set**: Set one or more environment variables (merges with existing) - **delete**: Delete one or more environment variables - **clear**: Clear all environment variables **Examples:** ```json // Read all env var keys { "operation": "read", "skill_name": "my-skill" } // Set single variable (merges with existing) { "operation": "set", "skill_name": "my-skill", "variables": {"API_KEY": "sk-123"} } // Set multiple variables (bulk merge) { "operation": "set", "skill_name": "my-skill", "variables": { "API_KEY": "sk-123", "DEBUG": "true", "TIMEOUT": "30" } } // Delete single variable { "operation": "delete", "skill_name": "my-skill", "keys": ["API_KEY"] } // Delete multiple variables { "operation": "delete", "skill_name": "my-skill", "keys": ["API_KEY", "DEBUG", "TIMEOUT"] } // Clear all environment variables { "operation": "clear", "skill_name": "my-skill" } ``` **Note:** The 'set' operation always merges with existing variables. To replace everything, use 'clear' first, then 'set'.""", inputSchema=SkillEnvCrudInput.model_json_schema(), ) ]