Skip to main content
Glama
godzeo
by godzeo

http_options

Send HTTP OPTIONS requests with headers, cookies, and timeout settings. Log all request details for security testing, API testing, and web automation workflows.

Instructions

HTTP OPTIONS request with full support (headers, cookies, timeout) - All requests logged

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cookiesNo
headersNo
timeoutNo
urlYes

Implementation Reference

  • The primary handler for the 'http_options' MCP tool. Decorated with @mcp.tool() for automatic registration and schema inference from type annotations. Executes HTTP OPTIONS request via shared helper.
    @mcp.tool()
    def http_options(
        url: str, 
        headers: Optional[Dict[str, str]] = None,
        cookies: Optional[Dict[str, str]] = None,
        timeout: float = 30.0
    ) -> str:
        """HTTP OPTIONS request with full support (headers, cookies, timeout) - All requests logged"""
        try:
            result = make_http_request_with_logging("OPTIONS", url, headers or {}, cookies or {}, "", timeout)
            return json.dumps(result, indent=2)
        except Exception as e:
            return f"Error: {str(e)}"
  • Core implementation logic for all HTTP tools including http_options. Performs the actual httpx request, captures full response details, logs everything, and returns structured JSON data.
    def make_http_request_with_logging(method: str, url: str, headers: dict, cookies: dict, body: str, timeout: float):
        """Universal HTTP request function with logging"""
        try:
            with httpx.Client(timeout=timeout) as client:
                response = client.request(
                    method=method.upper(),
                    url=url,
                    headers=headers,
                    cookies=cookies,
                    content=body.encode('utf-8') if body else None
                )
                
                # Log the request and response
                log_path = log_request_response(
                    method=method.upper(), 
                    url=url, 
                    headers=headers, 
                    cookies=cookies, 
                    body=body,
                    status_code=response.status_code,
                    response_headers=dict(response.headers),
                    response_content=response.text,
                    response_length=len(response.text)
                )
                
                return {
                    "method": method.upper(),
                    "url": url,
                    "status_code": response.status_code,
                    "response_headers": dict(response.headers),
                    "response_content": response.text,
                    "response_length": len(response.text),
                    "request_headers": headers,
                    "request_cookies": cookies,
                    "request_body": body,
                    "logged_to": log_path
                }
        except Exception as e:
            # Log the error
            log_request_response(
                method=method.upper(), url=url, headers=headers, cookies=cookies, body=body,
                status_code=0, response_headers={}, response_content="", response_length=0,
                error=str(e)
            )
            raise e
  • Supporting logger helper that records full request/response details (including headers, cookies, body preview) to timestamped files in ~/mcp_requests_logs for auditing.
    def log_request_response(method: str, url: str, headers: dict, cookies: dict, body: str, 
                            status_code: int, response_headers: dict, response_content: str, 
                            response_length: int, error: str = None):
        """Log complete request and response details"""
        log_data = {
            "timestamp": datetime.datetime.now().isoformat(),
            "request": {
                "method": method,
                "url": url,
                "headers": headers,
                "cookies": cookies,
                "body": body,
                "body_length": len(body) if body else 0
            },
            "response": {
                "status_code": status_code if not error else "ERROR",
                "headers": response_headers if not error else {},
                "content_length": response_length if not error else 0,
                "content_preview": response_content[:500] + "..." if response_content and len(response_content) > 500 else response_content
            },
            "error": error
        }
        
        logger.info(f"HTTP_REQUEST: {json.dumps(log_data, indent=2, ensure_ascii=False)}")
        return log_path
  • MCP server initialization where all @mcp.tool() decorated functions (including http_options) are automatically registered.
    mcp = FastMCP("HTTP Requests")
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that 'All requests logged', which is a useful behavioral trait beyond the basic operation. However, it lacks details on error handling, response format, authentication needs, or rate limits, leaving gaps for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action ('HTTP OPTIONS request') and lists key features. It avoids unnecessary words, though it could be slightly more structured (e.g., separating features with commas or bullets).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 0% schema description coverage, the description is incomplete. It mentions logging but omits critical context like response handling, error scenarios, or typical outputs. For a 4-parameter tool with siblings, more detail is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It mentions 'headers, cookies, timeout' but doesn't explain their purposes, formats, or interactions. For example, it doesn't clarify what 'timeout' units are (seconds), how cookies are formatted, or provide examples. This adds minimal value beyond the schema's property names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs an 'HTTP OPTIONS request' with specific features (headers, cookies, timeout), which is a specific verb+resource. It distinguishes from siblings by specifying the HTTP method (OPTIONS) versus DELETE, GET, HEAD, etc., though it doesn't explicitly contrast functionality beyond the method name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like http_get or http_raw_request. It mentions 'full support' but doesn't explain typical use cases for OPTIONS requests (e.g., CORS preflight, server capabilities) or when other HTTP methods might be more appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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/godzeo/mcp-request'

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