# Fetch — canonical payload contracts

Fetch a public URL and return its main content as markdown (Readability + markdownify, same approach as the official MCP fetch server).

**Service id:** `fetch`  
**Docs:** [https://mcp.glc-rag.hu/guide/fetch](https://mcp.glc-rag.hu/guide/fetch)  
**Markdown docs:** [https://mcp.glc-rag.hu/guide/fetch.md](https://mcp.glc-rag.hu/guide/fetch.md)  
**MCP resource:** `docs://fetch/payload`

POST `https://mcp.glc-rag.hu/mcp`. Values below are **type slots** from the live input schema (e.g. `<string, required>`), not example data. Fill them from the user task.

RPC result wrapper: `result.structuredContent` is the object in **Output schema**. `result.isError` mirrors `structuredContent.is_error`.

## `fetch`

Fetches a URL from the internet and extracts its contents as markdown. Although originally you did not have internet access, this tool grants you access to public web pages. Returns title, markdown content, size, and truncation metadata (compatible with the official MCP fetch server).

**Required arguments:** `url`

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "fetch",
    "arguments": {
      "url": "<string, required>",
      "max_length": "<integer, optional, default 5000, minimum 1, maximum 1000000>",
      "start_index": "<integer, optional, default 0, minimum 0>",
      "raw": "<boolean, optional, default False>"
    }
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "URL to fetch (http or https)"
    },
    "max_length": {
      "type": "integer",
      "description": "Maximum number of characters to return (default 5000).",
      "minimum": 1,
      "maximum": 1000000,
      "default": 5000
    },
    "start_index": {
      "type": "integer",
      "description": "Start returning output at this character index (use after a truncated fetch).",
      "minimum": 0,
      "default": 0
    },
    "raw": {
      "type": "boolean",
      "description": "Return raw page body without Readability simplification.",
      "default": false
    }
  },
  "required": [
    "url"
  ],
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "content": {
      "type": "string"
    },
    "truncated": {
      "type": "boolean"
    }
  },
  "additionalProperties": true,
  "required": [
    "url",
    "content"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```

## `fetch_status`

Fetch service health and default limits.

**Required arguments:** _(none)_

**Request contract**

```json
{
  "jsonrpc": "2.0",
  "id": "<integer|string>",
  "method": "tools/call",
  "params": {
    "name": "fetch_status",
    "arguments": {}
  }
}
```

**Input schema**

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

**Output schema** (`structuredContent` on success)

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    }
  },
  "additionalProperties": true,
  "required": [
    "ok"
  ]
}
```

**Error object**

```json
{
  "type": "object",
  "required": [
    "error",
    "is_error"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "is_error": {
      "type": "boolean",
      "const": true
    }
  },
  "additionalProperties": true
}
```
