> ## Documentation Index
> Fetch the complete documentation index at: https://docs.toorow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# FastMCP Agent Tools Reference

> Exhaustive technical reference for FastMCP tools exposed to AI agents in toorow.

This document provides a technical reference for all **FastMCP tools** mounted on the **toorow** microkernel server (`server/core/main.py`).

***

## 1. Analytics & Reporting Tools

### `get_daily_report`

Fetches canonical daily marketing metrics across all active connectors for a project.

```python theme={null}
get_daily_report(
    project_id: str = "default",
    report_profile: str = "daily",
    date_from: str = "",
    date_to: str = ""
) -> dict
```

* **Returns**: FastMCP dual-channel envelope (short LLM text summary + `structuredContent` payload for MCP App widgets).

### `<source>_report`

Source-specific report tools auto-discovered at boot (e.g. `google_analytics_report`, `meta_ads_report`, `mailgun_report`).

***

## 2. Intelligence & Surveillance Tools

### `get_morning_briefing`

Synthesizes the latest nightly briefing for an AI agent.

```python theme={null}
get_morning_briefing(project_id: str = "default") -> dict
```

* **Returns**: Daily KPI deltas, flagged anomalies (`anomalies_daily`), and active candidate context events (`context_events`).

### `get_source_capabilities`

Inspects source metadata, available fields, supported grains, and filter bounds.

```python theme={null}
get_source_capabilities(
    project_id: str,
    connection_ref_id: str
) -> dict
```

* **Returns**: Authoritative capability descriptor (schema version `1.2`).

***

## 3. Governed Flow Management Tools

### `flows_list` & `flows_get`

Lists or retrieves active datastreams and report configurations for a project.

### `flows_upsert`

Creates or updates a datastream or report configuration in a governed, audited manner.

```python theme={null}
flows_upsert(
    project_id: str,
    kind: str,  # "datastream" or "report"
    definition: dict
) -> dict
```

* **Guardrails**: Calls `validate_flow()` before database writes. Rejects unvalidated keys (`access_token`, `secret`) to enforce AD-3 security.

***

## 4. Observability & Feedback Tools

### `submit_feedback`

Submits user rating (+1 / -1) and optional commentary on an agent analysis trace (AD-13).

```python theme={null}
submit_feedback(
    trace_id: str,
    rating: int,  # 1 or -1
    feedback_text: str = ""
) -> dict
```

***

## Next Steps & Cross-References

<CardGroup cols={2}>
  <Card title="Agent Rules" icon="scroll" href="/agent-rules">
    Review system instructions and constraints for tool execution.
  </Card>

  <Card title="MCP App Use Cases" icon="layer-group" href="/use-cases-library">
    Explore interactive MCP App UI widgets powered by tool outputs.
  </Card>

  <Card title="MCP Host Integration" icon="network-wired" href="/mcp-host-integration">
    Connect external LLM clients to toorow's FastMCP server.
  </Card>

  <Card title="Agent Context" icon="database" href="/agent-context">
    Inspect schema discovery and context event integration.
  </Card>
</CardGroup>
