# TeamDay Admin Tool

Manage spaces, agents, MCPs, missions, skills, and secrets programmatically via the TeamdayAdmin MCP tool.

# TeamDay Admin Tool

The `TeamdayAdmin` tool gives agents full control over platform resources. Available as a built-in MCP tool at `mcp__teamday-admin__TeamdayAdmin`.

Use it to create workspaces, configure agents, install MCPs, schedule missions, manage skills, and store secrets --- all from within a conversation.

---

## Resources Overview

| Resource | Description | Key Actions |
|----------|-------------|-------------|
| **Spaces** | Workspaces / project directories | list, create, get, update, delete, discover |
| **Agents** | AI team members | list, create, get, update, delete |
| **MCPs** | Tool integrations (Google Analytics, etc.) | list, create, get, update, delete |
| **Missions** | Scheduled AI tasks | list, create, get, update, delete |
| **Skills** | Reusable agent capabilities | list, create |
| **Secrets** | Encrypted environment variables | list, store, remove |
| **Registry** | Browse available skills and MCPs | browseSkillsRegistry, browseMcpRegistry |

---

## Spaces

Spaces are workspaces --- think of them as project directories where agents do their work.

### Create a Space

```json
{
  "action": "createSpace",
  "data": {
    "name": "Marketing Hub",
    "description": "Content creation and SEO workspace",
    "visibility": "organization"
  }
}
```

### Update a Space

Add agents, skills, or a cover image:

```json
{
  "action": "updateSpace",
  "resourceId": "space-abc123",
  "data": {
    "addAgents": ["agent-id-1", "agent-id-2"],
    "addSkills": ["core:research"],
    "coverImage": "https://images.unsplash.com/photo-123",
    "coverImageAttribution": {
      "source": "unsplash",
      "photographerName": "Jane Doe"
    }
  }
}
```

### Discover Space

Scan the space filesystem for agents (`.claude/agents/*.md`), skills (`.claude/skills/*/SKILL.md`), and sync them to the platform database:

```json
{
  "action": "discoverSpace",
  "resourceId": "space-abc123"
}
```

This is useful after creating agents or skills via files --- the discover action makes them visible in the UI.

---

## Agents

Agents are AI team members with a name, role, system prompt, skills, and MCPs.

### Create an Agent

```json
{
  "action": "createAgent",
  "data": {
    "name": "Sarah",
    "role": "SEO Analyst",
    "category": "marketing",
    "systemPrompt": "You are Sarah, an SEO specialist...",
    "skillIds": ["seo", "content-analysis"],
    "advanced_tools": ["ahrefs"],
    "image": "https://www.teamday.ai/agents/agent-robot-1.png",
    "visibility": "organization"
  }
}
```

**Agent categories:** `marketing`, `finance`, `hr`, `engineering`, `operations`, `general`, `data`

---

## Adding Agents to Spaces

This is a **two-step process** --- agents are created independently, then added to spaces:

```json
// Step 1: Create the agent
{
  "action": "createAgent",
  "data": { "name": "Data Analyst", "role": "SQL and reporting" }
}
// Returns: { "id": "agent-xyz" }

// Step 2: Add to space
{
  "action": "updateSpace",
  "resourceId": "space-abc123",
  "data": { "addAgents": ["agent-xyz"] }
}
```

---

## MCPs (Tool Integrations)

Install MCP servers so agents can use external tools like Google Analytics, Ahrefs, or custom APIs.

### Create an MCP

```json
{
  "action": "createMcp",
  "data": {
    "name": "google-analytics",
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@anthropic-ai/mcp-google-analytics"],
    "env": {
      "GA_PROPERTY_ID": "12345678"
    }
  }
}
```

### Browse Available MCPs

```json
{
  "action": "browseMcpRegistry"
}
```

---

## Missions (Scheduled Tasks)

Missions are scheduled AI tasks that run automatically. Bind them to an agent to run with that agent's personality, skills, and MCPs.

### Create a Mission

```json
{
  "action": "createMission",
  "data": {
    "title": "Weekly SEO Report",
    "goal": "Analyze this week's search performance, compare to last week, and email the summary.",
    "spaceId": "space-abc123",
    "characterId": "char-sarah",
    "schedule": {
      "type": "cron",
      "value": "0 9 * * MON"
    }
  }
}
```

### Schedule Types

| Type | Description | Example |
|------|-------------|---------|
| `none` | Manual trigger only | --- |
| `once` | Run once at scheduled time | `"2026-03-01T09:00:00Z"` |
| `cron` | Recurring schedule | `"0 9 * * MON"` (Mondays 9am) |
| `continuous` | Run continuously | --- |

### Update a Mission

Pause, change schedule, or update the goal:

```json
{
  "action": "updateMission",
  "resourceId": "mission-abc",
  "data": {
    "status": "paused",
    "schedule": { "type": "cron", "value": "0 9 * * 1-5" }
  }
}
```

---

## Skills

Skills are reusable capabilities that teach agents how to perform specialized tasks.

### Browse Available Skills

```json
{
  "action": "browseSkillsRegistry"
}
```

### Create a Skill via API

```json
{
  "action": "createSkill",
  "data": {
    "name": "report-generator",
    "description": "Generate formatted PDF reports from data",
    "content": "---\nname: report-generator\ndescription: Generate reports\nallowed-tools: Bash, Read, Write\n---\n\n# Report Generator\n\n..."
  }
}
```

### Create a Skill via Files (Recommended)

Write the skill directly to the workspace filesystem, then run `discoverSpace`:

```
.claude/skills/report-generator/
  SKILL.md          # Skill definition
  scripts/
    generate.ts     # Executable script
```

---

## Secrets

Store encrypted environment variables for spaces. These are injected into agent sessions at runtime.

### Store Secrets

```json
{
  "action": "storeSecrets",
  "resourceId": "space-abc123",
  "data": {
    "secrets": {
      "OPENAI_API_KEY": "sk-...",
      "DATABASE_URL": "postgres://..."
    }
  }
}
```

### List Secrets

Returns secret names (not values) for a space:

```json
{
  "action": "listSecrets",
  "resourceId": "space-abc123"
}
```

### Remove Secrets

```json
{
  "action": "removeSecrets",
  "resourceId": "space-abc123",
  "data": {
    "keys": ["OPENAI_API_KEY"]
  }
}
```

---

## Agent Images

Use built-in avatar images from TeamDay's collection:

```
https://www.teamday.ai/agents/{style}-{number}.png
```

**Available styles** (numbers 1-9 each):
- `agent-new` --- Modern, clean
- `agent-sketch` --- Hand-drawn style
- `agent-geo` --- Geometric
- `agent-robot` --- Robot/mechanical
- `agent-animal` --- Animal characters
- `agent-fruit` --- Playful fruit characters

Or use any public image URL.

---

## File-Based Creation

The recommended workflow for agents and skills is file-based:

**1. Write agent file** to `.claude/agents/{name}.md`:

```yaml
---
name: Sarah
role: PPC Specialist
skills: [campaign-reporting]
tools: [WebSearch, Read, Write]
---
You are Sarah, a PPC specialist who helps manage advertising campaigns...
```

**2. Write skill file** to `.claude/skills/{name}/SKILL.md`:

```yaml
---
name: campaign-reporting
description: Generate campaign performance reports
allowed-tools: Bash, Read, Write
env: GA_API_KEY, OPENAI_API_KEY?
---
# Campaign Reporting Skill
...
```

**3. Run discoverSpace** to sync files to the platform database.

The `env` field in skills supports these patterns:
- `API_KEY` --- required
- `A | B | C` --- any one of (OR)
- `A, B` --- all required (AND)
- `KEY?` --- optional

---

## Error Handling

All actions return consistent response formats:

**Success:**
```
✅ Success
space: "Marketing Hub" (space-abc123)
```

**Validation error:**
```
❌ Validation failed for createSpace: name: Required
```

**API error:**
```
❌ Error: Insufficient permissions
```

The tool validates data client-side before making API calls, catching common mistakes like missing required fields.
