home/business/prompt-06-transport-behavior

PROMPT 06 Transport Behavior

GPTClaudeGemini··504 copies·updated 2026-07-14
prompt-06-transport-behavior.prompt
# Implementation Prompt 06: Transport Behavior and Stdio Implementation

**Goal:** Create the Transport behavior contract and stdio transport implementation using Port.

**Test Strategy:** TDD with rgr. All tests green, no warnings.

---

## Context: What You're Building

You're implementing the transport abstraction layer that Connection depends on. This includes:
1. **Transport behavior**: Defines the contract all transports must implement
2. **StdioTransport**: Spawns a subprocess via Port, sends/receives JSON-RPC frames over stdio

The transport is responsible for:
- Managing external process lifecycle
- Sending frames (JSON-RPC messages)
- Receiving frames and delivering to Connection
- Flow control via `set_active/2`
- Clean shutdown

> **Reminder (ADR-0014):** The `transport: {module(), opts}` option is the public plug-in point. Keep the behaviour generic (no Finch/Req assumptions) so users can drop in their own transports or override HTTP client pools without touching the connection.

---

## Required Reading: Transport Contract

From ADR-0002 and STATE_TRANSITIONS.md:

### Transport Message Contract

Transport MUST emit exactly these messages to Connection:

fill the variables

This prompt has 1 variable. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{module(), opts}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo nshkrdotcom/mcp_client (MIT). A "PROMPT 06 Transport Behavior" 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

businesscommunitygeneral

source

nshkrdotcom/mcp_client · MIT