C.W.K.
Stream
Lesson 04 of 05 · published

Prompts — Templated Workflow

~18 min · prompts, templates, user-invokable

Level 0호기심 많은 독자
0 XP0/48 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Prompts 는 평가절하된 primitive. MCP 의 Prompt 는 user 가 호출하는 — 보통 host UI 의 slash command 나 quick-pick 메뉴로 — server 정의 templated workflow. Server 가 wording, variable, structure 소유; user 가 인자 채우고 host 가 template 을 conversation seed 로 inflate.

Flow: client prompt list (prompts/list) → host 가 UI 에 user 호출 가능 item 으로 렌더 → user 가 골라 인자 제공 → host prompts/get → server 가 채워진 메시지 list 반환. 그 다음 host 가 그 메시지들을 LLM context 의 conversation 시작으로 inject.

왜 귀찮게? Server 작가가 자기 도메인의 맞는 phrasing 을 알아. GitHub MCP server 의 'summarize this PR' prompt 는 어떤 필드 (제목, 설명, 최근 commit, review comment) 를 가져올지, 모델한테 답을 어떻게 format 하라고 할지 알 수 있어. User 가 맞는 prompt 외울 필요 없어 — server 가 ship.

Prompt 는 protocol 의 나머지와 잘 합성. Prompt response 가 host 가 read 해야 하는 resource 참조 (template 작게 유지) 와 LLM 한테 다음 호출 hint 주는 tool 제안 포함 가능. Prompt 를 일회성 메시지 보내는 게 아니라 conversation setup 하는 server 의 기회로 다뤄.

Code

Python SDK 에서 prompt 정의·python
from mcp.server.fastmcp import FastMCP
from mcp.types import GetPromptResult, PromptMessage, TextContent

app = FastMCP("github-server")

@app.prompt()
def review_pr(pr_number: int) -> GetPromptResult:
    pr = github.get_pull(pr_number)
    return GetPromptResult(
        description=f"Review pull request #{pr_number}: {pr.title}",
        messages=[
            PromptMessage(role="user", content=TextContent(
                type="text",
                text=(
                    f"Review PR #{pr_number}.\n"
                    f"Title: {pr.title}\n"
                    f"Description: {pr.body}\n\n"
                    f"Focus on correctness and changes that touch user data. "
                    f"Suggest at most three improvements."
                ),
            )),
        ],
    )

External links

Exercise

작은 server 에 prompt 하나 추가 — 도메인 specific 한 'summarize_recent_changes' 나 'draft_release_notes' 같은 거. Claude Desktop 에서 연결해 slash-command UI 로 호출. User 가 prompt seed 메시지 보고 server 작가가 prompt-engineering 미리 해줬다는 걸 깨닫는 순간 봐.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.