Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

feat(mcp): reclaim ChatGPT profile budget by lowering compact description cap

Abdurrahman Fakhrula04e0e2f77e2
diff --git a/lib/mcp/chatgpt-profile.test.ts b/lib/mcp/chatgpt-profile.test.ts
index 772b51e1..3a7f72c0 100644
--- a/lib/mcp/chatgpt-profile.test.ts
+++ b/lib/mcp/chatgpt-profile.test.ts
@@ -35,7 +35,7 @@ describe("ChatGPT full generic MCP profile", () => {
if (process.env.MSO_PROFILE_METRICS === "1") console.info(`CHATGPT_PROFILE_METRICS tools=${tools.length} bytes=${bytes} roughTokens4=${Math.ceil(bytes/4)} maxToolBytes=${Math.max(...tools.map((tool)=>Buffer.byteLength(JSON.stringify(tool))))}`);
expect(bytes).toBeLessThan(92 * 1024);
const start = tools.find((tool) => tool.name === "workflow_start") as { description?: string };
- expect(String(start?.description)).toMatch(/First call for multi-step work/i);
+ expect(String(start?.description)).toMatch(/First call.*multi-step/i);
const search = tools.find((tool) => tool.name === "skills_search") as { description?: string };
expect(String(search?.description)).toContain("mso-agent-bootstrap");
expect(tools.some((tool) => tool.name === "local_agent_inbox")).toBe(true);
diff --git a/lib/mcp/tool-contract.ts b/lib/mcp/tool-contract.ts
index 2e1b90d8..37e59997 100644
--- a/lib/mcp/tool-contract.ts
+++ b/lib/mcp/tool-contract.ts
@@ -123,6 +123,10 @@ function compactSchema(value: unknown): unknown {
return out;
}
+const COMPACT_DESCRIPTIONS: Record<string, string> = {
+ workflow_start: "First call: multi-step",
+};
+
export function toolDescriptor(tool: McpTool, profile: McpToolProfile = "full") {
const securitySchemes = toolSecuritySchemes(tool);
// ChatGPT already receives the structured contract through published skill resources.
@@ -135,7 +139,7 @@ export function toolDescriptor(tool: McpTool, profile: McpToolProfile = "full")
return {
name: tool.name,
title: tool.title ?? toolTitle(tool.name),
- description: compact ? compactText(tool.chatgptDescription ?? tool.description, 30) : tool.description,
+ description: compact ? compactText(COMPACT_DESCRIPTIONS[tool.name] ?? tool.chatgptDescription ?? tool.description, 24) : tool.description,
inputSchema: compact ? compactSchema(tool.inputSchema) : tool.inputSchema,
...(outputSchema ? { outputSchema: compact ? compactSchema(outputSchema) : outputSchema } : {}),
securitySchemes,