mcp-server-stability-ai
Version:
MCP [Model Context Protocol](https://modelcontextprotocol.io/) Server integrating MCP Clients with [Stability AI](https://stability.ai/) image manipulation functionalities: generate, edit, upscale, and more.
29 lines (28 loc) • 990 B
JavaScript
import * as fs from "fs";
export const findAbsolutePathToolDefinition = {
name: "stability-ai-0-find-file",
description: `Find the absolute path of an image file based on the user's provided relative path or file name. For usage in Stability AI tools that require an absolute path.`,
inputSchema: {
type: "object",
properties: {
relativePath: {
type: "string",
description: "The relative path or file name to find the absolute path of.",
},
},
required: ["relativePath"],
},
};
export const findAbsolutePath = (args) => {
const { relativePath } = args;
const IMAGE_STORAGE_DIRECTORY = process.env.IMAGE_STORAGE_DIRECTORY;
const absolutePath = fs.realpathSync(`${IMAGE_STORAGE_DIRECTORY}/${relativePath}`);
return {
content: [
{
type: "text",
text: `Absolute path: ${absolutePath}`,
},
],
};
};