Download this file
| 1 | package mcpresource |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 5 | "bytes" |
| 6 | "encoding/json" |
| 7 | ) |
| 8 | |
| 9 | // The routing fixture contains no team, account or filesystem data. Every |
| 10 | // specialist and coordinator gets the same bytes, with no write operation. |
| 11 | func Result(method string, raw json.RawMessage) (any, error) { |
| 12 | const uri = "equipo://routing-check" |
| 13 | switch method { |
| 14 | case "resources/list": |
| 15 | return map[string]any{"resources": []any{map[string]string{"uri": uri, "name": "routing-check", "mimeType": "text/plain"}}}, nil |
| 16 | case "resources/templates/list": |
| 17 | return map[string]any{"resourceTemplates": []any{}}, nil |
| 18 | case "resources/read": |
| 19 | var params struct { |
| 20 | URI string `json:"uri"` |
| 21 | // Codex 0.165.0 sends a progress token on resource reads. |
| 22 | Meta json.RawMessage `json:"_meta,omitempty"` |
| 23 | } |
| 24 | if runnerproto.DecodeLimit(bytes.NewReader(raw), ¶ms, 64<<10) != nil || params.URI != uri { |
| 25 | return nil, runnerproto.ErrInvalid |
| 26 | } |
| 27 | return map[string]any{"contents": []any{map[string]string{"uri": uri, "mimeType": "text/plain", "text": "equipo-routing-ready"}}}, nil |
| 28 | } |
| 29 | return nil, runnerproto.ErrInvalid |
| 30 | } |
| 31 | |