Skip to main content
Glama
io.github.lorkorblaq/labloop-mcp

io.github.lorkorblaq/labloop-mcp

by lorkorblaq

LabLoop MCP (demo)

An unofficial, fictional Model Context Protocol server that demonstrates a complete, multi-step booking flow for medical lab tests:

search → compare prices → quote → confirm booking → escalate to a human

Everything here is fake. Tests, test centers, prices ("credits"), bookings, profiles, and escalation tickets are fictional and held in memory. The server makes no network calls, needs no credentials, and never books, charges, or messages anyone. It is not medical advice and is not affiliated with any real healthcare provider.

Why this exists

This server is a reference for designing tools that LLMs can chain reliably:

  • Rules live next to arguments. Guidance like "strip filler words before searching" or "use the exact id from a prior lookup" sits in each parameter's description instead of a long system prompt.

  • Two-step writes. The booking tool returns a full quote first (needs_confirmation) and only books when it is called again with confirm=true after the user agrees. A quote leaves no state behind.

  • Actionable non-happy paths. Results carry a status (ambiguous, not_found, needs_info with a missing list, invalid_test_id) plus a message telling the model what to do next, instead of a bare error.

  • Graceful degradation. Each test in a multi-test order falls back to its cheapest center when the preferred one doesn't offer it (flagged with providerFallback), and tests that can't be resolved are reported in skipped_tests without failing the whole order.

  • Small surface. The only runtime dependencies are mcp and pydantic.

Related MCP server: CUF Health Portal MCP Server

Tools

Tool

What it does

Read-only

labloop_list_tests

List the full catalog (id, name, abbreviation, category)

yes

labloop_find_test

Find a test by name or abbreviation; handles ambiguous matches and fuzzy suggestions

yes

labloop_get_test_providers

Test centers and prices for one test, cheapest first

yes

labloop_quote_or_book_collection

Quote (confirm=false) or book (confirm=true) a home sample collection for one or more tests

no

labloop_get_user_profile

Read saved demo contact details

yes

labloop_update_user_profile

Save demo contact details for reuse in later bookings

no

labloop_escalate_to_human

Simulated hand-off to a human agent; logs a ticket in memory

no

Install and run

Requires Python 3.10+. The server speaks MCP over stdio.

pip install labloop-mcp        # or: uvx labloop-mcp
labloop-mcp

Claude Desktop / Claude Code

{
  "mcpServers": {
    "labloop": { "command": "uvx", "args": ["labloop-mcp"] }
  }
}

With Claude Code: claude mcp add labloop -- uvx labloop-mcp

Try it with MCP Inspector

npx @modelcontextprotocol/inspector uvx labloop-mcp

Example conversation flow

  1. "How much is a thyroid test?" → labloop_find_test(name="thyroid") → labloop_get_test_providers(test_id="tst-thyroid")

  2. "Book it with a lipid panel for next Monday at 9am, 12 Willow Ave." → labloop_quote_or_book_collection(test_ids=["tst-thyroid","tst-lipid-panel"], user_id="demo-user-1", date_time="…", address="12 Willow Ave", phone_number="+15550000001") → returns needs_confirmation with the combined quote

  3. "Yes, go ahead." → the same call with confirm=true → successful, with simulated collectionId/schedulingId

  4. "This is wrong, I want a person." → labloop_escalate_to_human(...)

Security and privacy

  • No secrets, API keys, or environment variables are required or read.

  • No outbound network access. All state is in process memory and is cleared on restart.

  • Every input is validated by Pydantic before it reaches the tool logic (E.164 phone numbers, email format, length limits).

  • Don't enter real personal data; this is a demo.

Development

python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest
python scripts/smoke_test.py      # drives the server over stdio end-to-end

License

MIT

Available Tools

7 tools
labloop_escalate_to_humanEscalate to a human agentA

Hand the conversation to a human support agent (SIMULATED in this demo).

Use when the user asks for a real person, has a complaint, is frustrated, keeps hitting errors, or the request is beyond the other tools. Logs a ticket in memory and returns {status, simulated: true, ticketId, message}. No real message is sent.

Inputs: user_query (required), context. Returns: object

labloop_find_testFind a test by nameA
Read-onlyIdempotent

Look up a medical test by name or abbreviation to get its id and details.

Details include description, eligible gender, turnaround time (hours), preparation advice, and sample type. Returns one of:

  • {status: "found", test: {...}}: a single match; use test.id in later calls.

  • {status: "ambiguous", options: [...]}: several matches; ask the user to pick one.

  • {status: "not_found", suggestions: [...]}: nothing matched; offer the close suggestions.

Inputs: name (required). Returns: object

labloop_get_test_providersGet test prices by providerA
Read-onlyIdempotent

Get the test centers offering a test and their prices, cheapest first.

Returns {status, testId, testName, currency, providers: [{provider, price}]}, or {status: "invalid_test_id"} if the id is unknown.

Inputs: test_id (required). Returns: object

labloop_get_user_profileGet saved user detailsA
Read-onlyIdempotent

Fetch the demo user's saved contact details (name, phone, address, email).

Useful before booking, to avoid asking for details already on file. Profiles live in server memory only. Returns {status: "successful", profile} or {status: "not_found"}.

Inputs: user_id (required). Returns: object

labloop_list_testsList all testsA
Read-onlyIdempotent

List every test in the LabLoop catalog with its id, name, abbreviation, and category.

Use to browse what is available, or when labloop_find_test cannot find what the user means. Returns {status, count, tests: [{id, name, abbrev, category}]}.

Inputs: no named parameters. Returns: object

labloop_quote_or_book_collectionQuote or book a home sample collectionA

Order one or more tests as a single home sample-collection booking. This takes two steps.

  1. Call with confirm=false (default) to get ONE combined quote: each test's center and price, a logistics fee, and the grand total. Nothing is booked.

  2. After the user explicitly approves, call again with the same arguments and confirm=true.

Address, phone, and email fall back to the user's saved profile, and new details are saved back after booking. Status values: needs_info (ask the user for 'missing'), invalid_test_id, needs_confirmation (show the quote), successful (simulated booking with collectionId and schedulingId).

Inputs: user_id (required), test_ids (required), email, notes, +6 more. Returns: object

labloop_update_user_profileSave user detailsA
Idempotent

Save new or corrected contact details so future bookings can reuse them.

Only the fields provided are changed. Returns {status, updated_fields, profile}.

Inputs: user_id (required), name, email, phone, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: catalog listing, test lookup, provider pricing, booking, profile get/update, and human escalation. The list/find pair is explicitly differentiated by description, and no two tools appear interchangeable.

    Naming Consistency5/5

    All tool names consistently use the labloop_ prefix with snake_case verb_noun patterns like list_tests, find_test, get_test_providers, and update_user_profile. The compound quote_or_book_collection is longer but still follows the same predictable convention.

    Tool Count5/5

    Seven tools is well-scoped for this domain: catalog discovery, pricing, booking, profile management, and escalation. Each tool earns its place with no redundant or filler tools.

    Completeness4/5

    Core workflows are covered: browse/find tests, get providers, quote and confirm a booking, and manage user profile. However, there is no way to look up past bookings or cancel a collection, leaving a minor dead end after a successful booking.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables users to manage medical appointments by searching for doctors, checking availability, and booking sessions through a natural language interface. It serves as a reference implementation for advanced MCP features like symptom-based specialist recommendations and multi-step scheduling workflows.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Simulates a third-party appointment booking agent, enabling your AI platform to check availability and book appointments via MCP interoperability.
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables conversational CRUD management of a service catalog and service orders, including item manipulation, search, and business-rule validation through natural language.
      -