MCP: one error model and one serializer for every tool (validation errors are returned as success)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start with McpInvocationFilter, McpStdioToolCallTests.McpToolCall_WhenTheApiFails_IsReportedAsAToolError, and OutputHelper.WriteApiError to trace the existing error contract. Then inspect Features/Mcp/Tools, Program.cs, and McpHostCommand for duplicated handling and registration. Done means validation, write-service, serialization, logging, and registration behavior are unified without unreviewed golden or wire-contract changes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Why
Sharing was started but the MCP side of the contract was never finished, so every other slice of #38 inherits the problem.
- Validation and auth failures are returned as successful tool results (
return """{"error": "..."}"""), about 20 sites acrossTimesheetMcpTools,LeaveMcpToolsandAccountingMcpTools. API failures throw, so the SDK marks themisError. A client checkingisErrorsees the first class as success. - A third class escapes as a protocol error:
DateOnly.ParseExactin the tools throwsFormatExceptionfor bad input, even thoughTimesheetCreateService.ParseDatealready turns the same input into a validation exception. TimesheetWriteResult.Success == falseis an error on the CLI (UpdateCommand,AcceptCommand,CreateCommand) but serialised as ordinary content by the MCP tools.McpInvocationFilteronly recordsfailureon a throw, so the local command log shows returned errors as successes.- Serialiser policy is split:
OutputHelper.JsonOptionsomits nulls,AccountingMcpToolscopies that, the timesheet/leave/lookup tool classes write nulls, andCreateTimesheetalone usesOutputHelper.SerializeJson. This is why parity rows needPermittedDifferenceslike$.timesheet.invoiceId. - Adapter boilerplate is copied: three
ResolveEmpIdhelpers with two different semantics, three "not logged in" strings, and the DI registration list duplicated betweenProgram.csandMcpHostCommand(a new service must be registered twice).
Migrate
- One base validation exception (or error record) that
TimesheetValidationException, the leave validation exceptions and the import exceptions derive from; carry message, detail, recovery hint andmayHaveBeenApplied. - Map it once, in
McpInvocationFilter, to aCallToolResultwithIsError = trueand the same{"error":{code,message,detail}}body the CLI--jsonenvelope uses. Record the failure in the command log. - Remove every
catch … return "{\"error\"…}"and everyJsonOptsfield fromFeatures/Mcp/Tools; serialise throughOutputHelper.SerializeJson. - Parse dates in tools through one invariant helper that throws the validation exception.
- Treat
Success == falsefrom a write service the same way on both surfaces. - One
AddTimeProServices()extension used byProgram.csandMcpHostCommand; one shared tool helper for tenant/emp-id resolution.
How
Do this first; the other sharing issues assume it. McpStdioToolCallTests.ToolCall_WhenTheApiFails_IsReportedAsAToolError already proves the SDK maps a thrown exception to isError, so the filter can own the mapping and tools stop catching anything. OutputHelper.WriteApiError is the CLI half to mirror for detail and requestId.
Contract
Error payloads and null omission change MCP output. The code can land in a patch behind the existing goldens only if the old shapes are preserved; otherwise hold the wire change for 0.4.0 and regenerate goldens once (#71 first, so the regenerate is reviewable).
Part of #38.
- Ngôn ngữ chính
- C#
- Star
- 3
- Fork
- 0
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SSWConsulting/TimePro.Tools
-
Priority: P3 Type: Refactor
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
SSWConsulting/TimePro.Tools#101 ·
-
Priority: P3 Type: Refactor
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
SSWConsulting/TimePro.Tools#100 ·
-
Accounting: share product, SKU, rate, unbilled and recurring reads (unbilled paging is a no-op)Đang mởPriority: P3 Type: Refactor
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Priority: P2 Type: Refactor
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Priority: P2 Type: Bug Type: Refactor
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Tất cả issue của SSWConsulting/TimePro.Tools
Issue tương tự
-
good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
HicServices/RDMP#2398 ·
-
[Android] Memory leak in MAUI Graphics text drawing and measurement during repeated renderingĐang mởarea-drawing platform/android t/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
dotnet/maui#39676 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
is:bug is:FQNIssue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nunit/nunit3-vs-adapter#1527 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
MySQL: 3.10 Labels/Secrets uniqueness migrations hardcode database `Elsa`, so startup fails when the database has any other nameCó thể đã có người làm @sfmskywalker đã nhận hôm nay. Đang mởarea:persistence bug elsa 3 persistence prio high triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
elsa-workflows/elsa-core#9108 ·
Maintainer thường phản hồi trong vòng 1 ngày