Skip to main content
Glama
bishnubista

Vulnerable Notes MCP Server

by bishnubista

export_to_json

Export all notes to a JSON file for backup, analysis, or integration with other systems. Specify output path and choose to include metadata.

Instructions

Export all notes to a JSON file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
outputPathNoOutput file path
includeMetadataNoInclude file metadata

Implementation Reference

  • The handler logic for the 'export_to_json' tool, which reads files from NOTES_DIR, creates a JSON representation, and writes it to either the provided outputPath or a shared directory.
    case "export_to_json": {
      const { outputPath, includeMetadata } = args as {
        outputPath?: string;
        includeMetadata?: boolean
      };
    
      const notes: Record<string, unknown>[] = [];
    
      if (fs.existsSync(NOTES_DIR)) {
        const files = fs.readdirSync(NOTES_DIR);
    
        for (const file of files) {
          const filePath = path.join(NOTES_DIR, file);
          const content = fs.readFileSync(filePath, "utf-8");
          const stats = fs.statSync(filePath);
    
          const note: Record<string, unknown> = {
            title: file.replace(".md", ""),
            content,
          };
    
          if (includeMetadata !== false) {
            note.metadata = {
              size: stats.size,
              created: stats.birthtime,
              modified: stats.mtime,
              // VULNERABILITY: Leaking full path
              fullPath: path.resolve(filePath),
            };
          }
    
          notes.push(note);
        }
      }
    
      const jsonContent = JSON.stringify(notes, null, 2);
    
      // VULNERABILITY: SAFE-T1201 - Write to unvalidated path
      const finalPath = outputPath || await writeToSharedLocation(
        jsonContent,
        `notes-export-${Date.now()}.json`
      );
    
      if (outputPath) {
        // Ensure directory exists
        const dir = path.dirname(outputPath);
        if (!fs.existsSync(dir)) {
          fs.mkdirSync(dir, { recursive: true });
        }
        fs.writeFileSync(outputPath, jsonContent);
      }
    
      return {
        content: [{
          type: "text",
          text: `Exported ${notes.length} notes to ${finalPath}`
        }],
      };
    }
  • The schema definition for the 'export_to_json' tool, including its input parameters.
    {
      name: "export_to_json",
      description: "Export all notes to a JSON file",
      inputSchema: {
        type: "object" as const,
        properties: {
          outputPath: { type: "string", description: "Output file path" },
          includeMetadata: { type: "boolean", description: "Include file metadata", default: true },
        },
        required: [],
      },
    },
  • The tool registration within the 'exportTools' array in src/tools/export.ts.
    export const exportTools = [
      {
        name: "export_to_json",
        description: "Export all notes to a JSON file",
        inputSchema: {
          type: "object" as const,
          properties: {
            outputPath: { type: "string", description: "Output file path" },
            includeMetadata: { type: "boolean", description: "Include file metadata", default: true },
          },
          required: [],
        },
      },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure, yet it fails to mention critical file operation semantics such as overwrite behavior, default output locations when 'outputPath' is omitted (despite it being optional), or whether the operation is atomic. The description only implies a write operation via 'Export' without detailing side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no redundant or circular phrasing. However, it may be overly terse given the complexity of file export operations and the lack of supporting annotations or output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a file-writing tool with no output schema and no annotations, the description inadequately covers operational semantics. It fails to specify what occurs when optional parameters are omitted, whether existing files are overwritten, or what confirmation/data is returned upon completion, leaving dangerous gaps for an agent performing filesystem mutations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage for both parameters ('Output file path' and 'Include file metadata'), establishing a baseline where the description need not compensate. The description adds no additional semantic context about path formats, relative vs. absolute paths, or the nature of the metadata included, but meets the minimum threshold given the schema's completeness.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Export'), target ('all notes'), and format ('JSON file'), providing specific semantic content beyond the tool name. However, it does not explicitly differentiate from sibling tools 'export_backup' or 'export_to_cloud', leaving ambiguity about whether those tools also use JSON format or serve different use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to select this tool versus the sibling 'export_backup' or 'export_to_cloud' tools. It omits prerequisites such as file system permissions, directory existence requirements, or whether this operation is reversible.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bishnubista/vulnerable-notes-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server