PROMPT 07 Public Api
# Implementation Prompt 07: Public API Module
**Goal:** Create the public API module (McpClient) with high-level functions for starting connections, making requests, and managing the client.
**Test Strategy:** TDD with rgr. All tests green, no warnings.
---
## Context: What You're Building
You're implementing the user-facing API that wraps the Connection state machine. This provides:
1. **Connection lifecycle**: `start_link/1`, `stop/1`
2. **MCP operations**: `call_tool/3`, `list_tools/1`, `list_resources/1`, etc.
3. **Configuration**: Simple keyword list interface
4. **Error handling**: Normalized error returns
Users will interact with this module, not directly with Connection.
---
## Required Reading: API Specification
From MVP_SPEC.md and ADRs:
### Supported MCP Methods (MVP Scope)
**Tools:**
- `tools/list` → `list_tools/1`
- `tools/call` → `call_tool/3`
**Resources:**
- `resources/list` → `list_resources/1`
- `resources/read` → `read_resource/2`
- `resources/templates/list` → `list_resource_templates/1`
**Prompts:**
- `prompts/list` → `list_prompts/1`
- `prompts/get` → `get_prompt/2`
**General:**
- `ping` → `ping/1`
- `initialize` → (internal, handled by Connection)
### Configuration Optionswhen to use it
Community prompt sourced from the open-source GitHub repo nshkrdotcom/mcp_client (MIT). A "PROMPT 07 Public Api" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
codingcommunitydeveloper
source
nshkrdotcom/mcp_client · MIT
more in Coding
Coding✓ tested
Senior code review (strict mode)
senior staff engineer running a merciless but fair review
Coding✓ tested
Debug by hypothesis, not by guessing
debugging partner who forms theories before touching code
Coding✓ tested
Generate tests from described behavior
test engineer who writes tests that would actually catch regressions