@sylphlab/mcp-net-core
Version:
Core logic for MCP network tools
354 lines (343 loc) • 12.1 kB
text/typescript
import * as _sylphlab_mcp_core from '@sylphlab/mcp-core';
import { z } from 'zod';
import os from 'node:os';
declare const GetPublicIpToolInputSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
}, {
id?: string | undefined;
}>;
type GetPublicIpToolInput = z.infer<typeof GetPublicIpToolInputSchema>;
interface GetPublicIpResult {
/** Optional ID from the input. */
id?: string;
/** Whether retrieving the public IP was successful. */
success: boolean;
/** The public IP address string, if successful. */
ip?: string;
/** Error message, if retrieval failed. */
error?: string;
/** Suggestion for fixing the error. */
suggestion?: string;
}
declare const getPublicIpTool: _sylphlab_mcp_core.McpTool<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
}, {
id?: string | undefined;
}>, z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
success: z.ZodBoolean;
ip: z.ZodOptional<z.ZodString>;
error: z.ZodOptional<z.ZodString>;
suggestion: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
success: boolean;
id?: string | undefined;
ip?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
}, {
success: boolean;
id?: string | undefined;
ip?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
}>, "many">>;
declare const GetInterfacesToolInputSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
}, {
id?: string | undefined;
}>;
type GetInterfacesToolInput = z.infer<typeof GetInterfacesToolInputSchema>;
type NetworkInterfaces = {
[key: string]: os.NetworkInterfaceInfo[] | undefined;
};
interface GetInterfacesResult {
/** Optional ID from the input. */
id?: string;
/** Whether retrieving interfaces was successful. */
success: boolean;
/** The network interfaces object, if successful. */
result?: NetworkInterfaces;
/** Error message, if retrieval failed. */
error?: string;
/** Suggestion for fixing the error. */
suggestion?: string;
}
declare const getInterfacesTool: _sylphlab_mcp_core.McpTool<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
id?: string | undefined;
}, {
id?: string | undefined;
}>, z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
success: z.ZodBoolean;
result: z.ZodOptional<z.ZodType<NetworkInterfaces, z.ZodTypeDef, NetworkInterfaces>>;
error: z.ZodOptional<z.ZodString>;
suggestion: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
success: boolean;
id?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
result?: NetworkInterfaces | undefined;
}, {
success: boolean;
id?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
result?: NetworkInterfaces | undefined;
}>, "many">>;
declare const downloadTool: _sylphlab_mcp_core.McpTool<z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
url: z.ZodString;
destinationPath: z.ZodString;
overwrite: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
url: string;
destinationPath: string;
overwrite: boolean;
id?: string | undefined;
}, {
url: string;
destinationPath: string;
id?: string | undefined;
overwrite?: boolean | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
url: string;
destinationPath: string;
overwrite: boolean;
id?: string | undefined;
}[];
}, {
items: {
url: string;
destinationPath: string;
id?: string | undefined;
overwrite?: boolean | undefined;
}[];
}>, z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
path: z.ZodString;
success: z.ZodBoolean;
message: z.ZodOptional<z.ZodString>;
error: z.ZodOptional<z.ZodString>;
suggestion: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
path: string;
success: boolean;
id?: string | undefined;
message?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
}, {
path: string;
success: boolean;
id?: string | undefined;
message?: string | undefined;
error?: string | undefined;
suggestion?: string | undefined;
}>, "many">>;
declare const downloadToolInputSchema: z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
url: z.ZodString;
destinationPath: z.ZodString;
overwrite: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
url: string;
destinationPath: string;
overwrite: boolean;
id?: string | undefined;
}, {
url: string;
destinationPath: string;
id?: string | undefined;
overwrite?: boolean | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
url: string;
destinationPath: string;
overwrite: boolean;
id?: string | undefined;
}[];
}, {
items: {
url: string;
destinationPath: string;
id?: string | undefined;
overwrite?: boolean | undefined;
}[];
}>;
interface DownloadResultItem {
id?: string;
path: string;
success: boolean;
message?: string;
error?: string;
suggestion?: string;
}
declare const FetchItemSchema: z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
url: z.ZodString;
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
body: z.ZodOptional<z.ZodString>;
responseType: z.ZodDefault<z.ZodEnum<["text", "json", "ignore"]>>;
}, "strip", z.ZodTypeAny, {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
responseType: "text" | "json" | "ignore";
id?: string | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
}, {
url: string;
id?: string | undefined;
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
responseType?: "text" | "json" | "ignore" | undefined;
}>;
declare const fetchToolInputSchema: z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
url: z.ZodString;
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
body: z.ZodOptional<z.ZodString>;
responseType: z.ZodDefault<z.ZodEnum<["text", "json", "ignore"]>>;
}, "strip", z.ZodTypeAny, {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
responseType: "text" | "json" | "ignore";
id?: string | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
}, {
url: string;
id?: string | undefined;
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
responseType?: "text" | "json" | "ignore" | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
responseType: "text" | "json" | "ignore";
id?: string | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
}[];
}, {
items: {
url: string;
id?: string | undefined;
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
responseType?: "text" | "json" | "ignore" | undefined;
}[];
}>;
type FetchInputItem = z.infer<typeof FetchItemSchema>;
type FetchToolInput = z.infer<typeof fetchToolInputSchema>;
interface FetchResultItem {
/** Optional ID from the input item. */
id?: string;
/** Whether the fetch operation for this item was successful (HTTP status 2xx). */
success: boolean;
/** HTTP status code of the response. */
status?: number;
/** HTTP status text of the response. */
statusText?: string;
/** Response headers. */
headers?: Record<string, string>;
/** Parsed response body (string, JSON object, or null if ignored), if successful. */
body?: unknown;
/** Error message, if the operation failed. */
error?: string;
/** Suggestion for fixing the error. */
suggestion?: string;
}
declare const fetchTool: _sylphlab_mcp_core.McpTool<z.ZodObject<{
items: z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
url: z.ZodString;
method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]>>;
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
body: z.ZodOptional<z.ZodString>;
responseType: z.ZodDefault<z.ZodEnum<["text", "json", "ignore"]>>;
}, "strip", z.ZodTypeAny, {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
responseType: "text" | "json" | "ignore";
id?: string | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
}, {
url: string;
id?: string | undefined;
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
responseType?: "text" | "json" | "ignore" | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
items: {
url: string;
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
responseType: "text" | "json" | "ignore";
id?: string | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
}[];
}, {
items: {
url: string;
id?: string | undefined;
method?: "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS" | undefined;
headers?: Record<string, string> | undefined;
body?: string | undefined;
responseType?: "text" | "json" | "ignore" | undefined;
}[];
}>, z.ZodArray<z.ZodObject<{
id: z.ZodOptional<z.ZodString>;
success: z.ZodBoolean;
status: z.ZodOptional<z.ZodNumber>;
statusText: z.ZodOptional<z.ZodString>;
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
body: z.ZodOptional<z.ZodUnknown>;
error: z.ZodOptional<z.ZodString>;
suggestion: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
success: boolean;
id?: string | undefined;
status?: number | undefined;
error?: string | undefined;
suggestion?: string | undefined;
headers?: Record<string, string> | undefined;
body?: unknown;
statusText?: string | undefined;
}, {
success: boolean;
id?: string | undefined;
status?: number | undefined;
error?: string | undefined;
suggestion?: string | undefined;
headers?: Record<string, string> | undefined;
body?: unknown;
statusText?: string | undefined;
}>, "many">>;
export { type DownloadResultItem, type FetchInputItem, type FetchResultItem, type FetchToolInput, type GetInterfacesResult, type GetInterfacesToolInput, GetInterfacesToolInputSchema, type GetPublicIpResult, type GetPublicIpToolInput, GetPublicIpToolInputSchema, type NetworkInterfaces, downloadTool, downloadToolInputSchema, fetchTool, getInterfacesTool, getPublicIpTool };