Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(mcp): provider_usage tool reports each provider's usage limits #31644

Closeddymoo(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/31644/headopened View on GitHub

Showing 20 changed files with 121 additions and 0 deletions (loading 17).

x
0 of 20 viewed, 20 left
96 additions and 0 deletionsapps/server/src/mcp/toolkits/orchestrator/handlers.test.tsAdded
View file
@@ -0,0 +1,96 @@
+import { expect, it } from "@effect/vitest";
+import {
+ EnvironmentId,
+ OrchestratorMcpProviderUsageResult,
+ ProviderDriverKind,
+ ProviderInstanceId,
+} from "@t3tools/contracts";
+import * as Effect from "effect/Effect";
+import * as Layer from "effect/Layer";
+import * as Schema from "effect/Schema";
+import * as Stream from "effect/Stream";
+​
+import * as ThreadManagement from "../../../orchestration-v2/ThreadManagementService.ts";
+import * as PeerForwarding from "../../../peer/PeerForwarding.ts";
+import * as PeerLinkRequests from "../../../peer/PeerLinkRequests.ts";
+import * as PeerLinks from "../../../peer/PeerLinks.ts";
+import * as ProviderRegistryMock from "../../../provider/testUtils/providerRegistryMock.ts";
+import * as ProviderUsage from "../../../usage/ProviderUsage.ts";
+import * as UsageLimitSources from "../../../usage/UsageLimitSources.ts";
+import * as McpInvocationContext from "../../McpInvocationContext.ts";
+import * as McpToolAccess from "../../McpToolAccess.ts";
+import * as OrchestratorMcpService from "../../OrchestratorMcpService.ts";
+import * as ThreadMetadataMcpService from "../../ThreadMetadataMcpService.ts";
+import * as OrchestratorHandlers from "./handlers.ts";
+import { OrchestratorToolkit } from "./tools.ts";
+​
+const decodeResult = Schema.decodeUnknownEffect(OrchestratorMcpProviderUsageResult);
+​
+it.effect("provider_usage answers a read-only client outside any thread", () =>
+ Effect.gen(function* () {