# API

## Tools

### Organization Discovery

#### List Organizations (`list_organizations`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Lists all accessible GitBook organizations.
* **Parameters:** None
* **Returns:**

```json
{
    "organizations": [
        {
            "id": "string",
            "title": "string",
            "urls": {
                "app": "string",
                "public": "string"
            }
        }
    ]
}
```

### Space Management

#### List Spaces (`list_spaces`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Lists spaces, optionally filtered by organization.
* **Parameters:**
  * `organizationId` (optional): Organization ID to filter spaces
* **Returns:**

```json
{
    "spaces": [
        {
            "id": "string",
            "title": "string",
            "visibility": "string",
            "urls": {
                "app": "string",
                "public": "string"
            }
        }
    ]
}
```

#### Get Space Details (`get_space`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves detailed information about a specific space.
* **Parameters:**
  * `spaceId` (required): The ID of the space to retrieve
* **Returns:**

```json
{
    "id": "string",
    "title": "string",
    "description": "string",
    "visibility": "string",
    "urls": {
        "app": "string",
        "public": "string"
    }
}
```

#### Get Space Content (`get_space_content`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves the content structure and pages of a space.
* **Parameters:**
  * `spaceId` (optional): The ID of the space (uses default if configured)
* **Returns:**

```json
{
    "pages": [
        {
            "id": "string",
            "title": "string",
            "slug": "string",
            "path": "string"
        }
    ]
}
```

#### Search Content (`search_content`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Searches for content within a space using full-text search.
* **Parameters:**
  * `query` (required): Search query string
  * `spaceId` (optional): The ID of the space to search (uses default if configured)
* **Returns:**

```json
{
    "results": [
        {
            "id": "string",
            "title": "string",
            "excerpt": "string",
            "url": "string"
        }
    ]
}
```

### Content Retrieval

#### Get Page Content (`get_page_content`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves the content of a specific page.
* **Parameters:**
  * `pageId` (required): The ID of the page to retrieve
  * `spaceId` (optional): The ID of the space containing the page
  * `format` (optional): Output format (`"document"` or `"markdown"`, defaults to `"document"`)
  * `metadata` (optional): Include revision metadata (boolean, defaults to `false`)
  * `computed` (optional): Include computed revision data (boolean, defaults to `false`)
* **Returns:**

```json
{
    "id": "string",
    "title": "string",
    "content": "string",
    "format": "string"
}
```

#### Get Page by Path (`get_page_by_path`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves page content using the page path.
* **Parameters:**
  * `pagePath` (required): The path of the page to retrieve
  * `spaceId` (optional): The ID of the space containing the page
* **Returns:**

```json
{
    "id": "string",
    "title": "string",
    "content": "string",
    "path": "string"
}
```

### File Management

#### Get Space Files (`get_space_files`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Lists all files in a space.
* **Parameters:**
  * `spaceId` (optional): The ID of the space (uses default if configured)
* **Returns:**

```json
{
    "files": [
        {
            "id": "string",
            "name": "string",
            "downloadURL": "string",
            "size": "number"
        }
    ]
}
```

#### Get File Details (`get_file`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves details of a specific file.
* **Parameters:**
  * `fileId` (required): The ID of the file to retrieve
  * `spaceId` (optional): The ID of the space containing the file
* **Returns:**

```json
{
    "id": "string",
    "name": "string",
    "downloadURL": "string",
    "size": "number",
    "uploadedAt": "string"
}
```

### Collection Management

#### List Collections (`list_collections`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Lists all accessible collections.
* **Parameters:**
  * `organizationId` (optional): Organization ID to filter collections
* **Returns:**

```json
{
    "collections": [
        {
            "id": "string",
            "title": "string",
            "description": "string"
        }
    ]
}
```

#### Get Collection Details (`get_collection`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Retrieves details of a specific collection.
* **Parameters:**
  * `collectionId` (required): The ID of the collection to retrieve
* **Returns:**

```json
{
    "id": "string",
    "title": "string",
    "description": "string",
    "spaces": "number"
}
```

#### Get Collection Spaces (`get_collection_spaces`)

* **Behavior:** 📖 Read-only, 🔄 Idempotent, 🌐 Open-world
* **Description:** Lists all spaces within a collection.
* **Parameters:**
  * `collectionId` (required): The ID of the collection
* **Returns:**

```json
{
    "spaces": [
        {
            "id": "string",
            "title": "string",
            "visibility": "string"
        }
    ]
}
```

## Prompts

### Fetch Documentation (`fetch_documentation`)

* **Description:** Fetches and analyzes GitBook documentation content for specific topics.
* **Parameters:**
  * `topic` (required): The topic or subject to search for and analyze
  * `spaceId` (optional): The ID of the space to search (uses default if configured)
  * `includeStructure` (optional): Set to "true" to include space structure
* **Returns:**
  * A comprehensive analysis of documentation related to the specified topic, including relevant pages, content summaries, and improvement areas.

### Analyze Content Gaps (`analyze_content_gaps`)

* **Description:** Identifies gaps and missing content in documentation.
* **Parameters:**
  * `spaceId` (optional): The ID of the space to analyze (uses default if configured)
  * `comparisonSource` (optional): Source to compare against (default: "internal analysis")
* **Returns:**
  * A detailed gap analysis including missing topics, incomplete sections, and suggestions for new content areas.

### Content Audit (`content_audit`)

* **Description:** Performs quality audits of documentation content.
* **Parameters:**
  * `spaceId` (optional): The ID of the space to audit (uses default if configured)
  * `auditCriteria` (optional): Specific criteria to audit (default: "general quality and consistency")
* **Returns:**
  * A comprehensive quality assessment including content quality, outdated information, and style recommendations.

### Documentation Summary (`documentation_summary`)

* **Description:** Generates comprehensive summaries of GitBook spaces.
* **Parameters:**
  * `spaceId` (optional): The ID of the space to summarize (uses default if configured)
  * `summaryType` (optional): Type of summary - "overview", "technical", "user-guide", or "custom" (default: "overview")
* **Returns:**
  * A structured summary including space structure, main topics, and target audience.

### Content Optimization (`content_optimization`)

* **Description:** Optimizes content for SEO, readability, structure, or performance.
* **Parameters:**
  * `spaceId` (optional): The ID of the space to optimize (uses default if configured)
  * `optimizationType` (required): Type of optimization - "SEO", "readability", "structure", or "performance"
  * `targetMetrics` (optional): Specific metrics or goals to optimize for
* **Returns:**
  * Optimization recommendations including improvement strategies and implementation guidance.
