Update repository with project files and documentation
- Added comprehensive documentation (BUILD_AND_TEST, CLIENT_CONFIG, KNOWN_ISSUES, ROADMAP, etc.) - Updated core functionality for board outline, size, and utilities - Added new tools for project, routing, schematic, and UI management - Included TypeScript SDK with full MCP implementation - Updated configuration examples for all platforms - Added changelog and status tracking - Improved Python utilities with KiCAD process management - Enhanced resource helpers and server capabilities 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
101
src/tools/routing.ts
Normal file
101
src/tools/routing.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Routing tools for KiCAD MCP server
|
||||
*/
|
||||
|
||||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import { z } from 'zod';
|
||||
|
||||
export function registerRoutingTools(server: McpServer, callKicadScript: Function) {
|
||||
// Add net tool
|
||||
server.tool(
|
||||
"add_net",
|
||||
"Create a new net on the PCB",
|
||||
{
|
||||
name: z.string().describe("Net name"),
|
||||
netClass: z.string().optional().describe("Net class name"),
|
||||
},
|
||||
async (args: { name: string; netClass?: string }) => {
|
||||
const result = await callKicadScript("add_net", args);
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// Route trace tool
|
||||
server.tool(
|
||||
"route_trace",
|
||||
"Route a trace between two points",
|
||||
{
|
||||
start: z.object({
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
unit: z.string().optional()
|
||||
}).describe("Start position"),
|
||||
end: z.object({
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
unit: z.string().optional()
|
||||
}).describe("End position"),
|
||||
layer: z.string().describe("PCB layer"),
|
||||
width: z.number().describe("Trace width in mm"),
|
||||
net: z.string().describe("Net name"),
|
||||
},
|
||||
async (args: any) => {
|
||||
const result = await callKicadScript("route_trace", args);
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// Add via tool
|
||||
server.tool(
|
||||
"add_via",
|
||||
"Add a via to the PCB",
|
||||
{
|
||||
position: z.object({
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
unit: z.string().optional()
|
||||
}).describe("Via position"),
|
||||
net: z.string().describe("Net name"),
|
||||
viaType: z.string().optional().describe("Via type (through, blind, buried)"),
|
||||
},
|
||||
async (args: any) => {
|
||||
const result = await callKicadScript("add_via", args);
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// Add copper pour tool
|
||||
server.tool(
|
||||
"add_copper_pour",
|
||||
"Add a copper pour (ground/power plane) to the PCB",
|
||||
{
|
||||
layer: z.string().describe("PCB layer"),
|
||||
net: z.string().describe("Net name"),
|
||||
clearance: z.number().optional().describe("Clearance in mm"),
|
||||
},
|
||||
async (args: any) => {
|
||||
const result = await callKicadScript("add_copper_pour", args);
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
text: JSON.stringify(result, null, 2)
|
||||
}]
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user