Initial project import

This commit is contained in:
Agila Forge Importer committed 2026-07-13 15:20:32 +00:00
commit 23f2d29e32
11957 files changed
+1754577

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
# mcp integration tests
These tests keep MCP traffic in memory. They do not start stdio, HTTP, a child
process, or any external MCP service.
The coverage target is the `x.async` boundary around MCP-shaped work:
- build an MCP request;
- decode and validate it inside a `Task`;
- produce an MCP response;
- decode the result after `Task.wait()`.
@@ -0,0 +1,28 @@
import context
import mcp
import x.async as xasync
struct TestEchoArgs {
pub:
text string
}
fn test_mcp_task_dispatches_in_memory_request() {
request := mcp.new_request(1, 'tools/call', TestEchoArgs{
text: 'hello'
})
mut task := xasync.run[mcp.Response](fn [request] (mut ctx context.Context) !mcp.Response {
_ = ctx
req := mcp.decode_request(request.encode())!
if req.method != 'tools/call' {
return error('unexpected MCP method')
}
args := req.decode_params[TestEchoArgs]()!
result := mcp.tool_text_result(args.text)
return mcp.new_response(1, result, mcp.ResponseError{})
})!
response := task.wait()!
result := response.decode_result[mcp.ToolResult]()!
assert result.content.contains('hello')
}