close-app
Close a running DOS gaming server to resolve startup errors and free system resources for new game sessions.
Instructions
Close an existing running mcp-dos server. You can use this tool if you are getting erros when starting a new server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port | Yes | The port of the app to close. |
Implementation Reference
- src/tools/close-app.ts:19-48 (handler)The main handler function for the 'close-app' tool. It performs a GET request to http://localhost:${port}/close to shut down the server and returns a response with success or error message.export default async function closeApp({ port }: InferSchema<typeof schema>) { try { const response = await fetch(`http://localhost:${port}/close`, { method: "GET", }); const data = await response.text(); return { content: [ { type: "text", text: `Closed server on port ${port}`, }, { type: "text", text: data, } ], } } catch (error) { return { content: [ { type: "text", text: `Error closing server on port ${port}: ${error}`, }, ], } } }
- src/tools/close-app.ts:4-6 (schema)Input schema defining the 'port' parameter as a number.export const schema = { port: z.number().describe("The port of the app to close."), };
- src/tools/close-app.ts:8-17 (registration)Tool metadata registration including name, description, and annotations.export const metadata = { name: "close-app", description: "Close an existing running mcp-dos server. You can use this tool if you are getting erros when starting a new server.", annotations: { title: "Close app", readOnlyHint: true, destructiveHint: true, idempotentHint: true, }, };
- src/tools/open-dos.ts:195-202 (helper)HTTP endpoints (/close GET and POST) that the close-app tool calls to actually close the server instance.app.get('/close', (req, res) => { getGlobalServer()?.close(); res.send('Server closed'); }); app.post('/close', (req, res) => { getGlobalServer()?.close(); res.send('Server closed');