Skip to main content
Glama

msf_session_cmd

Execute a command on an active Metasploit session (shell or Meterpreter) by providing the session ID and command. Set an optional timeout to control wait time.

Instructions

Execute a command on an active Metasploit session (shell or Meterpreter).

WARNING: This is a destructive operation that executes commands on a compromised system. Requires explicit authorization.

Args: session_id: Active session ID (e.g. "1", "2"). Only digits are accepted. command: Command to execute (e.g. "id", "whoami", "cat /etc/shadow"). timeout: Maximum seconds to wait for output (default: 30).

Returns: Command output with session type and session ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
timeoutNo
session_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

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

With no annotations, the description carries the full burden and discloses critical behavioral traits: it is destructive, requires explicit authorization, accepts only numeric session IDs, and returns command output with session type and ID. It does not mention error handling or what happens on session failure, but covers the essential safety and output expectations.

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

Conciseness5/5

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

The description is well-structured with a clear first-line purpose, a warning, an Args section, and a Returns section. It is concise, with every sentence adding value and no redundancy.

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

Completeness5/5

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

Despite the lack of annotations and a relatively simple tool, the description covers the essential aspects: what it does, parameters, safety warning, and return value. The presence of an output schema means it doesn't need to detail return structure further. It is complete for an agent to select and invoke correctly.

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

Parameters5/5

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

The schema provides only types and defaults, but the description richly documents each parameter with examples, constraints (e.g., 'Only digits are accepted' for session_id), and the timeout default. This fully compensates for the 0% schema description coverage.

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

Purpose5/5

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

The description clearly states 'Execute a command on an active Metasploit session (shell or Meterpreter)', identifying the specific verb, resource, and scope. This distinguishes it from sibling tools like msf_sessions_list (listing sessions) and msf_run_module (running modules).

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

Usage Guidelines4/5

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

The description implies this is for post-exploitation when an active session exists, and the purpose is specific enough to avoid confusion with alternatives. However, it does not explicitly mention when not to use it or name alternative tools, which would be a 5. The destructive warning and 'requires explicit authorization' provide important usage context.

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/rfunix/tengu'

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