Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Available tools:
- `quantlab_outputs_list`
- `quantlab_artifact_read`

`quantlab_outputs_list` accepts optional `relative_path` and `entry_kind` filters (`all`, `directory`, `file`).

The server entrypoint is `mcp-server.mjs`, and the `mcp` npm script runs it directly.

## Current Tabs
Expand Down
26 changes: 20 additions & 6 deletions desktop/mcp-server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function runPythonCli(args, timeoutMs = 120000) {
});
}

async function listOutputs(relativePath = "") {
async function listOutputs(relativePath = "", entryKind = "all") {
const targetPath = resolveOutputsPath(relativePath);
const stat = await fs.stat(targetPath);
if (!stat.isDirectory()) {
Expand Down Expand Up @@ -142,12 +142,20 @@ async function listOutputs(relativePath = "") {
return left.name.localeCompare(right.name);
});

let filtered = detailed;
if (entryKind === "directory") {
filtered = detailed.filter((item) => item.kind === "directory");
} else if (entryKind === "file") {
filtered = detailed.filter((item) => item.kind === "file");
}

return {
root: "outputs",
requested_path: relativePath || ".",
absolute_path: targetPath,
entry_count: detailed.length,
entries: detailed,
entry_kind: entryKind,
entry_count: filtered.length,
entries: filtered,
};
}

Expand Down Expand Up @@ -286,13 +294,19 @@ async function main() {
});

server.registerTool("quantlab_outputs_list", {
description: "List artifacts and directories under outputs/.",
description:
"List artifacts and directories under outputs/. Optional entry_kind filters to files or directories only (default all).",
inputSchema: {
relative_path: z.string().optional().default("").describe("Path relative to outputs/"),
entry_kind: z
.enum(["all", "directory", "file"])
.optional()
.default("all")
.describe('List "all" entries, or only "directory" or "file"'),
},
}, async ({ relative_path }) => {
}, async ({ relative_path, entry_kind }) => {
try {
const payload = await listOutputs(relative_path);
const payload = await listOutputs(relative_path, entry_kind);
return {
content: [
{
Expand Down
Loading