remove_api
Delete a saved API configuration from the OpenAPI proxy server to manage stored endpoints and schemas.
Instructions
Remove a saved API configuration
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the API to remove |
Implementation Reference
- RemoveApiTool class: core handler for 'remove_api' tool. Sets name, description, references schema via create_name_input_schema(), and handle_call executes by calling config_manager.remove_api with the provided name.class RemoveApiTool(ConfigTool, ToolDefinitionMixin): """Tool for removing API configurations.""" def __init__(self, config_manager): super().__init__( name="remove_api", description="Remove a saved API configuration", config_manager=config_manager, ) def get_tool_definition(self) -> Tool: return Tool( name=self.name, description=self.description, inputSchema=self.create_name_input_schema(), ) async def handle_call(self, arguments: Dict[str, Any]) -> List[TextContent]: try: result = await self.config_manager.remove_api(arguments["name"]) return self._create_text_response(result) except Exception as e: return self._create_error_response(e)
- Static method defining the input schema for remove_api tool: object with required 'name' string field.def create_name_input_schema() -> Dict[str, Any]: """Create input schema for name parameter.""" return { "type": "object", "properties": { "name": {"type": "string", "description": "Name of the API to remove"} }, "required": ["name"], }
- openapi_mcp_proxy/services/tool_registry.py:40-43 (registration)Registration: instantiation of RemoveApiTool with config_manager and addition to the tools list in ToolRegistry._register_tools().# API Management Tools AddApiTool(self.config_manager), ListSavedApisTool(self.config_manager), RemoveApiTool(self.config_manager),
- ConfigManager.remove_api(): invoked by tool handler, calls storage.remove_api(name), saves config if successful, returns success message.async def remove_api(self, name: str) -> str: """Remove an API configuration.""" if not self._storage.remove_api(name): raise ValueError(f"API '{name}' not found") await self.save_config() logger.info(f"Removed API configuration: {name}") return f"Removed API '{name}'"
- ApiConfigStorage.remove_api(name): low-level storage operation that deletes the API by name from the internal apis dict if exists.def remove_api(self, name: str) -> bool: """Remove an API configuration. Returns True if removed, False if not found.""" if name in self.apis: del self.apis[name] return True return False