mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 08:11:24 +02:00
Run oxfmt across repo, add format script and ignore config
Format all non-generated files with oxfmt via `vp fmt`. Add .oxfmtignore to skip bindings/ and wasm-pack output. Add npm format script and update DEVELOPMENT.md docs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import * as z from 'zod';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
import { getWorkspaceContext } from './helpers.js';
|
||||
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
||||
import * as z from "zod";
|
||||
import type { McpServerContext } from "../types.js";
|
||||
import { getWorkspaceContext } from "./helpers.js";
|
||||
import {
|
||||
authenticationSchema,
|
||||
authenticationTypeSchema,
|
||||
headersSchema,
|
||||
workspaceIdSchema,
|
||||
} from './schemas.js';
|
||||
} from "./schemas.js";
|
||||
|
||||
export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'list_folders',
|
||||
"list_folders",
|
||||
{
|
||||
title: 'List Folders',
|
||||
description: 'List all folders in a workspace',
|
||||
title: "List Folders",
|
||||
description: "List all folders in a workspace",
|
||||
inputSchema: {
|
||||
workspaceId: workspaceIdSchema,
|
||||
},
|
||||
@@ -26,7 +26,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
type: "text" as const,
|
||||
text: JSON.stringify(folders, null, 2),
|
||||
},
|
||||
],
|
||||
@@ -35,12 +35,12 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'get_folder',
|
||||
"get_folder",
|
||||
{
|
||||
title: 'Get Folder',
|
||||
description: 'Get details of a specific folder by ID',
|
||||
title: "Get Folder",
|
||||
description: "Get details of a specific folder by ID",
|
||||
inputSchema: {
|
||||
id: z.string().describe('The folder ID'),
|
||||
id: z.string().describe("The folder ID"),
|
||||
workspaceId: workspaceIdSchema,
|
||||
},
|
||||
},
|
||||
@@ -51,7 +51,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
type: "text" as const,
|
||||
text: JSON.stringify(folder, null, 2),
|
||||
},
|
||||
],
|
||||
@@ -60,17 +60,17 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'create_folder',
|
||||
"create_folder",
|
||||
{
|
||||
title: 'Create Folder',
|
||||
description: 'Create a new folder in a workspace',
|
||||
title: "Create Folder",
|
||||
description: "Create a new folder in a workspace",
|
||||
inputSchema: {
|
||||
workspaceId: workspaceIdSchema,
|
||||
name: z.string().describe('Folder name'),
|
||||
folderId: z.string().optional().describe('Parent folder ID (for nested folders)'),
|
||||
description: z.string().optional().describe('Folder description'),
|
||||
sortPriority: z.number().optional().describe('Sort priority for ordering'),
|
||||
headers: headersSchema.describe('Default headers to apply to requests in this folder'),
|
||||
name: z.string().describe("Folder name"),
|
||||
folderId: z.string().optional().describe("Parent folder ID (for nested folders)"),
|
||||
description: z.string().optional().describe("Folder description"),
|
||||
sortPriority: z.number().optional().describe("Sort priority for ordering"),
|
||||
headers: headersSchema.describe("Default headers to apply to requests in this folder"),
|
||||
authenticationType: authenticationTypeSchema,
|
||||
authentication: authenticationSchema,
|
||||
},
|
||||
@@ -79,7 +79,7 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, ogWorkspaceId);
|
||||
const workspaceId = await workspaceCtx.yaak.window.workspaceId();
|
||||
if (!workspaceId) {
|
||||
throw new Error('No workspace is open');
|
||||
throw new Error("No workspace is open");
|
||||
}
|
||||
|
||||
const folder = await workspaceCtx.yaak.folder.create({
|
||||
@@ -88,24 +88,24 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
});
|
||||
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(folder, null, 2) }],
|
||||
content: [{ type: "text" as const, text: JSON.stringify(folder, null, 2) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'update_folder',
|
||||
"update_folder",
|
||||
{
|
||||
title: 'Update Folder',
|
||||
description: 'Update an existing folder',
|
||||
title: "Update Folder",
|
||||
description: "Update an existing folder",
|
||||
inputSchema: {
|
||||
id: z.string().describe('Folder ID to update'),
|
||||
id: z.string().describe("Folder ID to update"),
|
||||
workspaceId: workspaceIdSchema,
|
||||
name: z.string().optional().describe('Folder name'),
|
||||
folderId: z.string().optional().describe('Parent folder ID (for nested folders)'),
|
||||
description: z.string().optional().describe('Folder description'),
|
||||
sortPriority: z.number().optional().describe('Sort priority for ordering'),
|
||||
headers: headersSchema.describe('Default headers to apply to requests in this folder'),
|
||||
name: z.string().optional().describe("Folder name"),
|
||||
folderId: z.string().optional().describe("Parent folder ID (for nested folders)"),
|
||||
description: z.string().optional().describe("Folder description"),
|
||||
sortPriority: z.number().optional().describe("Sort priority for ordering"),
|
||||
headers: headersSchema.describe("Default headers to apply to requests in this folder"),
|
||||
authenticationType: authenticationTypeSchema,
|
||||
authentication: authenticationSchema,
|
||||
},
|
||||
@@ -124,24 +124,24 @@ export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
id,
|
||||
});
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(folder, null, 2) }],
|
||||
content: [{ type: "text" as const, text: JSON.stringify(folder, null, 2) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'delete_folder',
|
||||
"delete_folder",
|
||||
{
|
||||
title: 'Delete Folder',
|
||||
description: 'Delete a folder by ID',
|
||||
title: "Delete Folder",
|
||||
description: "Delete a folder by ID",
|
||||
inputSchema: {
|
||||
id: z.string().describe('Folder ID to delete'),
|
||||
id: z.string().describe("Folder ID to delete"),
|
||||
},
|
||||
},
|
||||
async ({ id }) => {
|
||||
const folder = await ctx.yaak.folder.delete({ id });
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: `Deleted: ${folder.name} (${folder.id})` }],
|
||||
content: [{ type: "text" as const, text: `Deleted: ${folder.name} (${folder.id})` }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user