Agent 활용 Tool 설정하기
Tool Calling과 Context 주입
Tool Calling 즉, MCP를 사용할 때 필요한 Context를 주입할 때 단순히 호출하는 것이 아니라, 특정 상황/조건에서만 호출되도록 제어하는 것이 중요
도구 호출의 불안정성
도구 호출 자체는 확률적 동작이므로 불안정할 수 있음
따라서 단순 호출에 의존하지 않고, Rule 정의를 통해 호출 기준을 명확히 지정해야 함
Rule 기반 보완
도구 호출의 조건과 트리거를 Rule에 정의하여 보완해야 함
Ex: "코드 생성이 필요한 경우 → 반드시 context7을 주입한 후 MCP 호출" 과 같은 규칙
예외 상황 처리
Rule을 모두 지정해도 간헐적으로 호출이 실패할 수 있음.
이 경우 멈추고, 명확한 동작을 보장하도록 추가 지시(보정 작업) 를 수행해야 함
확률성에 대한 인지
AI는 확률적으로 움직이는 존재임을 전제로 MCP를 활용해야 함
따라서 "안정성 확보 = Rule 기반 + 보정 작업"의 조합이 필수
MCP user rules 예시
Always use context7 when I need code generation, setup or configuration steps, or library/API documentation. This means you should automatically use the Context7 MCP tools to resolve library id and get library docs without me having to explicitly ask.
After any context change (viewing new files, running commands, or receiving tool outputs), use the "mcp_think" tool to organize your reasoning before responding. Specifically, always use the think tool when: - After examining file contents or project structure - After running terminal commands or analyzing their outputs - After receiving search results or API responses - Before making code suggestions or explaining complex concepts - When transitioning between different parts of a task When using the think tool: - List the specific rules or constraints that apply to the current task - Check if all required information is collected - Verify that your planned approach is correct - Break down complex problems into clearly defined steps - Analyze outputs from other tools thoroughly - Plan multi-step approaches before executing them The think tool has been proven to improve performance by up to 54% on complex tasks, especially when working with multiple tools or following detailed policies.
Last updated