api_request
Execute custom API requests to SD Elements endpoints using specified HTTP methods, endpoints, parameters, and body data for integration with the security development lifecycle platform.
Instructions
Make a custom API request to any SD Elements endpoint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | Request body data as key-value pairs | |
| endpoint | Yes | API endpoint (e.g., 'projects/', 'applications/123/') | |
| method | Yes | HTTP method for the request | |
| params | No | URL parameters as key-value pairs |
Implementation Reference
- The main handler function for the 'api_request' tool. It is decorated with @mcp.tool() which registers it automatically. The function makes a generic API request using the global api_client and returns JSON-formatted result.@mcp.tool() async def api_request(ctx: Context, method: str, endpoint: str, params: Optional[Dict[str, Any]] = None, data: Optional[Dict[str, Any]] = None) -> str: """Make a generic API request to a custom endpoint. Use when user says 'make a GET/POST/PUT/DELETE request', 'call API endpoint', or 'custom API call'. Do NOT use for specific operations - use dedicated tools like get_project instead.""" global api_client if api_client is None: api_client = init_api_client() result = api_client.api_request(method, endpoint, params, data) return json.dumps(result, indent=2)
- src/sde_mcp_server/server.py:296-296 (registration)Import of the tools module which triggers registration of all tools including api_request via their @mcp.tool() decorators.from . import tools # noqa: F401
- src/sde_mcp_server/tools/__init__.py:12-12 (registration)Import of generic.py which registers the api_request tool via @mcp.tool() decorator.from .generic import *