Skip to content

Commit d44e5a6

Browse files
committed
feat: add validate tool to format phone numbers from environment variables
1 parent 0da206d commit d44e5a6

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

src/app/api/[transport]/route.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,44 @@ const handler = async (req: Request) => {
9595
},
9696
);
9797

98+
// Validate tool - returns phone number in {country_code}{number} format from env
99+
server.tool(
100+
"validate",
101+
"Validate and format a phone number from environment variables",
102+
{},
103+
async () => {
104+
// Get phone number and country code from environment variables
105+
const number = process.env.PHONE_NUMBER || "";
106+
const country_code = process.env.COUNTRY_CODE || "+1";
107+
108+
// Remove any non-digit characters from the number
109+
const cleanNumber = number.replace(/\D/g, '');
110+
const formattedNumber = `${country_code}${cleanNumber}`;
111+
112+
return {
113+
content: [{
114+
type: "text",
115+
text: formattedNumber
116+
}],
117+
};
118+
},
119+
);
120+
98121
// About tool - returns server name and description
99122
server.tool(
100123
"about",
101124
"Get information about this MCP server",
102125
{},
103126
async () => {
127+
const serverInfo = {
128+
name: "VaultAssist MCP",
129+
description: "A secure OAuth 2.1 Model Context Protocol (MCP) server providing advanced tools for Google services, memory graph, and sequential thinking capabilities."
130+
};
131+
104132
return {
105133
content: [{
106134
type: "text",
107-
text: `Name: VaultAssist MCP\nDescription: A secure OAuth 2.1 Model Context Protocol (MCP) server providing advanced tools for Google services, memory graph, and sequential thinking capabilities.`
135+
text: JSON.stringify(serverInfo, null, 2)
108136
}],
109137
};
110138
},
@@ -142,6 +170,9 @@ const handler = async (req: Request) => {
142170
roll_dice: {
143171
description: "Roll an N-sided die",
144172
},
173+
validate: {
174+
description: "Validate and format a phone number from environment variables",
175+
},
145176
about: {
146177
description: "Get information about this MCP server",
147178
},

0 commit comments

Comments
 (0)