Skip to main content
Glama

delete_npc

Remove an existing NPC from the MemoryMesh knowledge graph by specifying its name. Streamlines entity management and maintains graph accuracy.

Instructions

Delete an existing npc from the knowledge graph

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
delete_npcYesDelete parameters for npc

Implementation Reference

  • Dynamically generates the schema/definition for the 'delete_npc' tool when processing the 'npc' schema. Defines input as {delete_npc: {name: string}}.
    const deleteSchema: Tool = {
        name: `delete_${schemaName}`,
        description: `Delete
        an existing
        ${schemaName}
        from
        the
        knowledge
        graph`,
        inputSchema: {
            type: "object",
            properties: {
                [`delete_${schemaName}`]: {
                    type: "object",
                    description: `Delete parameters for ${schemaName}`,
                    properties: {
                        name: {
                            type: "string",
                            description: `The name of the ${schemaName} to delete`
                        }
                    },
                    required: ["name"]
                }
            },
            required: [`delete_${schemaName}`]
        }
    };
    
    tools.push(deleteSchema);
  • Dispatches calls to 'delete_npc' by parsing input args[`delete_npc`] to extract node name and invoking the core delete handler.
    case 'delete': {
        const {name} = args[`delete_${schemaName}`];
        if (!name) {
            return formatToolError({
                operation: toolName,
                error: `Name is required to delete a ${schemaName}`,
                suggestions: ["Provide the 'name' parameter"]
            });
        }
        return handleSchemaDelete(name, schemaName, knowledgeGraphManager);
    }
  • Core handler function that performs the deletion of the NPC node. Verifies existence by name and type ('npc'), then invokes deleteNodes on ApplicationManager, which removes the node and its edges.
    export async function handleSchemaDelete(
        nodeName: string,
        nodeType: string,
        applicationManager: ApplicationManager
    ): Promise<ToolResponse> {
        try {
            const graph = await applicationManager.readGraph();
            const node = graph.nodes.find((n: Node) => n.name === nodeName && n.nodeType === nodeType);
    
            if (!node) {
                return formatToolError({
                    operation: 'deleteSchema',
                    error: `${nodeType} "${nodeName}" not found`,
                    context: {nodeName, nodeType},
                    suggestions: ["Verify node name and type"]
                });
            }
    
            await applicationManager.deleteNodes([nodeName]);
    
            return formatToolResponse({
                actionTaken: `Deleted ${nodeType}: ${nodeName}`
            });
        } catch (error) {
            return formatToolError({
                operation: 'deleteSchema',
                error: error instanceof Error ? error.message : 'Unknown error occurred',
                context: {nodeName, nodeType},
                suggestions: [
                    "Check node exists",
                    "Verify delete permissions"
                ],
                recoverySteps: [
                    "Ensure no dependent nodes exist",
                    "Try retrieving node first"
                ]
            });
        }
    }
  • Registers all dynamic tools, including 'delete_npc', from the dynamic tool manager into the central ToolsRegistry during initialization.
    await dynamicToolManager.initialize();
    dynamicToolManager.getTools().forEach(tool => {
        this.tools.set(tool.name, tool);
    });
  • During initialization, generates and caches dynamic tools for each schema loaded from data/schemas/, including 'delete_npc' for 'npc.schema.json'.
    // Generate tools for each schema
    for (const [schemaName, schema] of this.schemas.entries()) {
        const tools = await this.generateToolsForSchema(schemaName, schema);
        tools.forEach(tool => this.toolsCache.set(tool.name, tool));
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'Delete' which implies a destructive mutation, but doesn't disclose behavioral traits like whether deletion is permanent, requires specific permissions, affects related data (e.g., edges), or provides confirmation. For a destructive tool with zero annotation coverage, this is inadequate.

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

Conciseness3/5

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

The description is concise but poorly structured with unnecessary line breaks ('Delete\n an existing\n npc\n from\n the\n knowledge\n graph'), making it less readable. The content is front-loaded with the core action, but the formatting detracts from clarity.

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?

Given this is a destructive mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover critical aspects like what happens on success/failure, return values, or side effects. With 1 parameter and 100% schema coverage, the parameter part is adequate, but overall context for safe usage is lacking.

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?

Schema description coverage is 100%, with the parameter 'name' clearly documented in the schema as 'The name of the npc to delete'. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

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 ('Delete') and target resource ('an existing npc from the knowledge graph'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling delete tools (e.g., delete_artifact, delete_currency) beyond specifying the npc resource type, which is somewhat implied but not strongly contrasted.

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 use this tool versus alternatives. It doesn't mention prerequisites (e.g., npc must exist), consequences, or when to choose other tools like update_npc or delete_nodes. With many sibling tools available, this lack of context is a significant gap.

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

Related 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/CheMiguel23/MemoryMesh'

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