# Gabby MCP Quick Guide

# Gabby MCP Quick Guide

Gabby is a natural-language tool selection workflow backed. It provides both REST APIs and MCP tools via the Zuplo Gateway.

- REST: `/v1/gabby/smart`, `/v1/gabby/tasks/:task_id`
- MCP: `/mcp/gabby` (JSON-RPC: initialize → tools/list → tools/call)

Authentication
- Header: `Authorization: Bearer <api-key>` (Zuplo API Key)
- For MCP, include `Accept: application/json, text/event-stream` header

MCP initialize
```text
POST /mcp/gabby

JSON-RPC method: initialize
Protocol version: 2024-11-05
```

Endpoints (REST)
- POST /v1/gabby/smart
  - Body fields: query (string), limit? (number), language? ("auto"|"ja"|"en"), mode? ("blocking"|"async")
  - 200: result; 202: status, workflow_run_id, task_id
- GET /v1/gabby/tasks/:task_id
  - 200: completed result; 202: running/paused
  - Pass workflow_run_id as the path value for result retrieval. The path parameter name is kept as task_id for compatibility.
- DELETE /v1/gabby/tasks/:task_id
  - 202: status is "cancel_requested"
  - Pass task_id, not workflow_run_id, when canceling.

MCP Tools
- gabby_smart
- get_gabby_task_status
- cancel_gabby_task

Examples
```bash
curl -X POST "https://e-catalog-search-main-ae100fb.d2.zuplo.dev/v1/gabby/smart" \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  --data '{"query":"I need a 10 mm roughing end mill for AISI 304 stainless steel. Recommend a tool and provide cutting speed and feed suggestions."}'
```
Response (202):
```text
status: running
mode: deferred
task_id: task_123
workflow_run_id: run_456
next_action: call get_gabby_task_status with workflow_run_id
poll_after_seconds: 5
```

Async mode example (poll for status after 202)
```text
POST /v1/gabby/smart
mode: async

202 response:
status: running
task_id: task_xxx
workflow_run_id: run_xxx

GET  /v1/gabby/tasks/run_xxx
DELETE /v1/gabby/tasks/task_xxx
```

MCP tool call example (gabby_smart / blocking)
```text
JSON-RPC method: tools/call
Tool name: gabby_smart
Arguments body:
  query: Recommend a 10 mm end mill for aluminum 6061 slotting; include coating and chip evacuation notes.
  limit: 2
  language: en
  mode: blocking
```

MCP tool call example (get_gabby_task_status)
```text
JSON-RPC method: tools/call
Tool name: get_gabby_task_status
Path parameter task_id: run_xxx
```

Notes
- Rate limits: e.g., smart 10/min/user, tasks 60/min/user
- To avoid character encoding issues, send JSON bodies as UTF-8