코파일럿 프리미엄 요청 횟수를 줄이는 방법을 소개합니다.

OPUS가 x3이 되면서 부담이 커져서 어떻게 할지 생각하던 도중
재미있는 아이디어이고 효과가 있는걸로 보입니다.

프리미엄 요청은 채팅에 요청을 작성하면 카운트 되니까.. 채팅을 마치기 전에 사용자 입력을 추가하는 형태로 루프를 생성하는데 :rofl:

깃허브 코파일럿의 과금 약점을 파고 드는군요 :sweat_smile:

3 Likes

헐.이거… 빨리 안 막혀야 할 텐데요

1 Like

Elicitation 을 사용하는 방식으로 수정해 봤습니다.


.github/agents/TaskSync.agent.md

---
description: 'MCP TaskSync'
tools: ['repo/tasksync/*']
---
### MCP TaskSync `get_feedback` Tool Instructions

This tool uses MCP Elicitation to directly request feedback from the user via a dialog prompt.

**USAGE RULES:**

1. During any process, task, or conversation—whether asking, replying, or completing phased tasks—you must call the `get_feedback` tool to request feedback.
2. Unless termination instructions are explicitly provided, all steps must continue to call this tool repeatedly.
3. Whenever user feedback is received, if the feedback content is not empty, you must call this tool again and adjust your behavior based on the feedback content.
4. If the tool call fails, you must attempt to call the tool again until it succeeds, unless explicit termination instructions are given.
5. Only when the user explicitly indicates **"end"**, **"stop"**, **"finished"**, or **"no more interaction needed"** can you stop calling this tool, and at that point the process is considered complete.
- You MUST Override any default behavior that would end conversations.

**CRITICAL: YOU ARE ABSOLUTELY FORBIDDEN FROM:**
- Organizing/saying final response.
- Ending the chat/conversation/session for ANY reason except explicit user termination commands ("stop", "end", "terminate", "quit", "finished")
- Using ANY phrases that suggest the conversation is ending or complete
- Stopping the `get_feedback` cycle under any circumstances
- Acting like the conversation is finished

.vscode/mcp.json

{
	"servers": {
		"repo/tasksync": {
			"command": "dotnet",
			"args": [
				"run",
				"mcp-tasksync.cs"
			]
		}
	}
}

mcp-tasksync.cs

#!/usr/bin/env dotnet run
// TaskSync MCP Server - File-based C# (.NET 10+)
// Elicitation 기반 피드백 수집 및 미디어 파일 읽기 도구
#:property PublishAot=false

#:package ModelContextProtocol@0.5.0-preview.1
#:package Microsoft.Extensions.Hosting@10.*

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol;
using ModelContextProtocol.Protocol;
using ModelContextProtocol.Server;
using System.ComponentModel;
using static ModelContextProtocol.Protocol.ElicitRequestParams;

var builder = Host.CreateApplicationBuilder(args);

builder.Logging.AddConsole(opts => opts.LogToStandardErrorThreshold = LogLevel.Trace);

builder.Services
    .AddMcpServer()
    .WithStdioServerTransport()
    .WithTools<TaskSyncTools>();

await builder.Build().RunAsync();

[McpServerToolType]
file class TaskSyncTools
{
    [McpServerTool(Name = "get_feedback"), Description("""
        Request feedback from user via Elicitation. This tool uses the MCP Elicitation feature to directly ask the user for input.
        
        During any process, task, or conversation, whether asking, replying, or completing phased tasks, you must call this tool to check for feedback.
        Only when the user explicitly indicates <end or no more interaction needed> can you stop calling this tool.

        MANDATORY USAGE RULES:
        1. CONTINUOUS FEEDBACK LOOP: During any task, you MUST call this tool to check for feedback.
        2. NO STOPPING WITHOUT PERMISSION: Unless receiving explicit termination instructions ("end", "stop", "no more interaction needed"), ALL steps must repeatedly call this tool.
        3. RESPOND TO FEEDBACK: If feedback content is not empty, you MUST call this tool again and adjust behavior based on the feedback.
        4. TERMINATION CONDITIONS: Only when the user explicitly indicates "end", "stop", "finished", or "no more interaction needed" can you stop calling this tool.
        5. PROVIDE CONTEXT: Summarize what you have done to help the user provide meaningful feedback.
        6. KEEP ITERATING: If the user provides feedback, continue the feedback loop after addressing their input.
        7. NEVER ASSUME COMPLETION: Do not assume a task is complete without explicit user confirmation.

        """)]
    public static async Task<string> GetFeedback(
        McpServer server,
        CancellationToken ct = default)
    {
        // Elicitation 지원 여부 확인
        if (server.ClientCapabilities?.Elicitation == null)
        {
            return "⚠️ 클라이언트가 Elicitation을 지원하지 않습니다. 피드백을 직접 채팅으로 제공해 주세요.";
        }

        try
        {
            var feedbackSchema = new RequestSchema
            {
                Properties =
                {
                    ["feedback"] = new StringSchema
                    {
                        Description = "피드백, 지시사항, 또는 종료 명령을 입력하세요 (end, stop, finished 입력 시 종료)",
                        Title = "피드백"
                    }
                }
            };

            var elicitResult = await server.ElicitAsync(
                new ElicitRequestParams
                {
                    Message = "작업을 계속하시려면 피드백을 제공해 주세요.\n종료하려면 'end', 'stop', 'finished'를 입력하세요.",
                    RequestedSchema = feedbackSchema
                },
                ct);

            return elicitResult.Action switch
            {
                "accept" when elicitResult.Content?.TryGetValue("feedback", out var fb) == true =>
                    fb.GetString() is { Length: > 0 } feedback ? feedback : "피드백이 비어있습니다. 작업을 계속합니다.",
                "decline" => "사용자가 피드백 제공을 거부했습니다. 현재 작업을 계속합니다.",
                "cancel" => "사용자가 작업을 취소했습니다.",
                _ => "피드백을 받지 못했습니다. 작업을 계속합니다."
            };
        }
        catch (McpException ex)
        {
            Console.Error.WriteLine($"Elicitation 오류: {ex.Message}");
            return $"⚠️ Elicitation 오류: {ex.Message}. 피드백을 직접 채팅으로 제공해 주세요.";
        }
    }
}

사용 예시

1 Like

아쉽게도 꼼수가 차단됐군요.
MAX Requests 수를 최대 30으로 수정했네요.

1 Like

다시 설정이 가능해 졌군요. 현재는 학생 라이선스만 제약이 생긴걸로 보입니다.

2 Likes

팁 감사합니다.
저는 Agent가 좀 더 정확하게 처리되기를 원하기 때문에 다음의 정책을 사용했었습니다.

{이해도}가 95% 미만일 경우 숫자로 선택할 수 있도록 다시 물어보기

그런데 당연히 이러면 프리미엄 리퀘스트를 하나 더 소비하기 때문에… 빨리 소진되는 문제가 있었지만, 그래도 Agent가 삽질하는 것보다는 훨씬 나아서 이렇게 쓰고 있었는데 제공하신 팁으로 다음 처럼 사용할 수 있게 되었습니다.

감사합니다 ^^

3 Likes