{
  "openapi": "3.1.1",
  "info": {
    "title": "Knotwork API",
    "version": "1.0.0",
    "summary": "Deterministic tools for people and AI agents.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://knotwork.usefulweb.site"
    }
  ],
  "paths": {
    "/api/v1/tools": {
      "get": {
        "operationId": "listTools",
        "summary": "Catalog of all tools",
        "responses": {
          "200": {
            "description": "Tool list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/{id}": {
      "get": {
        "operationId": "getTool",
        "summary": "Definition of one tool",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "knotwork-link-graph",
                "knotwork-wikilink-map",
                "knotwork-link-suggestions",
                "graph-algorithm-visualizer"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/knotwork-link-graph/calculate": {
      "post": {
        "operationId": "calculateKnotworkLinkGraph",
        "summary": "Degree, groups, shortest path and PageRank for any link graph — find hubs and orphans.",
        "description": "Paste the links between your pages, issues, notes or any other items — as an edge list (“A -\u003e B”) or JSON with nodes and edges — and get the number of links per item (in, out and total), the connected groups, the most linked hubs, the most central items by PageRank, the orphans nobody links to and, if you name two items, the shortest chain of links between them. The same analysis Knotwork runs on a workspace graph.\n\nMethodology:\n- Links are directed (from → to). Duplicate links and self-loops are counted once / ignored; end points that are not listed as nodes are added.\n- Degree = number of distinct items linked with an item in either direction; in/out count links that point to / leave it. Hubs are sorted by degree, then incoming links, then input order.\n- Connected groups (weakly connected components) and the shortest path use breadth-first search with neighbours in input order, so the same input always gives the same path. The path ignores link direction unless you tick the option.\n- PageRank: power iteration of r = (1 − d)/N + d · (Σ r(j)/out(j) over items j linking here + r(dangling)/N), where items without outgoing links spread their rank over all items; it stops when the total change is below 10⁻¹⁰ (at most 200 rounds). Scores sum to 1.\n- Orphans are items with no link at all. Density = links ÷ (N · (N − 1)).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "knotwork_link_graph",
        "x-owner-app": "knotwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnotworkLinkGraphInput"
              },
              "examples": {
                "example1": {
                  "summary": "Product team: hubs, orphans and the path from Ana to the mobile app",
                  "value": {
                    "graph": "# Product team knowledge: one link per line (from -\u003e to)\nRoadmap 2027 -\u003e Checkout redesign\nRoadmap 2027 -\u003e Mobile app\nCheckout redesign -\u003e WEB-12 Payment form\nCheckout redesign -\u003e WEB-14 Address autocomplete\nWEB-12 Payment form -\u003e WEB-14 Address autocomplete\nWEB-15 Card validation -\u003e WEB-12 Payment form\nMobile app -\u003e APP-3 Offline mode\n#design-review message -\u003e Checkout redesign\n#design-review message -\u003e WEB-12 Payment form\nCard: Usability test -\u003e Checkout redesign\nAna -\u003e WEB-12 Payment form\nBen -\u003e APP-3 Offline mode\nOld onboarding notes",
                    "from": "Ana",
                    "to": "Mobile app"
                  }
                },
                "example2": {
                  "summary": "Directed cycle: every page gets the same PageRank",
                  "value": {
                    "graph": "A -\u003e B\nB -\u003e C\nC -\u003e A",
                    "from": "",
                    "to": ""
                  }
                },
                "example3": {
                  "summary": "JSON graph with two groups",
                  "value": {
                    "graph": "{\"nodes\":[{\"id\":\"p1\",\"title\":\"Onboarding\",\"kind\":\"page\"},{\"id\":\"p2\",\"title\":\"Payroll FAQ\",\"kind\":\"page\"},{\"id\":\"i1\",\"title\":\"HR-4 Laptop order\",\"kind\":\"issue\"},{\"id\":\"p3\",\"title\":\"Office map\",\"kind\":\"page\"},{\"id\":\"p4\",\"title\":\"Parking\",\"kind\":\"page\"}],\"edges\":[{\"from\":\"p1\",\"to\":\"p2\"},{\"from\":\"p1\",\"to\":\"i1\"},{\"from\":\"p3\",\"to\":\"p4\"}]}",
                    "from": "p2",
                    "to": "i1"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnotworkLinkGraphResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/knotwork-wikilink-map/calculate": {
      "post": {
        "operationId": "calculateKnotworkWikilinkMap",
        "summary": "Map the [[links]] between Markdown notes: broken links, orphan pages, hubs and mentions.",
        "description": "Paste Markdown notes that link to each other with [[Page title]] (also [[Page|label]], [[KEY:Page]] and links to other .md files) and @[Name] mentions. The map resolves every link by title, lists broken links to pages that do not exist, orphan pages that nothing links to and nothing links from, the most linked pages and who is mentioned where — with Wikinest’s Markdown reader, the same one Knotwork uses for wiki pages and imported notes.\n\nMethodology:\n- Each note is parsed with Wikinest’s Markdown reader: [[Title]], [[Title|label]], [[KEY:Title]] (the key is dropped when no note has it in its title) and [[Title#heading]] link to the note with that title, compared without case and extra spaces; Markdown links to “name.md” link to the note whose title or file name is “name”.\n- @[Name] mentions become person items. Links to web addresses are counted as external and not followed. Code blocks are not searched for links.\n- Broken links point to a title no note has. Orphans have no link in either direction. Hubs, groups and PageRank come from the knotwork-link-graph analysis.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "knotwork_wikilink_map",
        "x-owner-app": "knotwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnotworkWikilinkMapInput"
              },
              "examples": {
                "example1": {
                  "summary": "Team wiki with a broken link and an orphan page",
                  "value": {
                    "notes": "=== Onboarding\nStart with [[Team handbook]] and [[Tools we use]]. Ask @[Ana Silva] for access.\n=== Team handbook\nHow we work: see [[Meeting rules]] and [[Release process]].\n=== Release process\nChecklist in [[Tools we use]]. Owner: @[Ben Okafor]. Old notes: [[Release 2025]].\n=== Tools we use\nIssue tracker, chat and the wiki. Back to [[Onboarding]].\n=== Meeting rules\nShort, with an agenda.\n=== Parking\nGarage on level -2."
                  }
                },
                "example2": {
                  "summary": "Notes with # headings and a link to another .md file",
                  "value": {
                    "notes": "# Ideas\nSee [[Reading list]] and [details](plans.md).\n# Reading list\nBack to [[Ideas]].\n# Plans\nNothing yet."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnotworkWikilinkMapResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/knotwork-link-suggestions/calculate": {
      "post": {
        "operationId": "calculateKnotworkLinkSuggestions",
        "summary": "Find notes that mention another note by name but do not link to it yet — and add the [[links]].",
        "description": "Paste Markdown notes and the finder lists every place where one note names another note (or one of your extra titles) without a [[link]]: which note, which title, the words as written, how often and a short context. Matching is by whole words, ignores case and accents, handles titles of several words, scripts without spaces such as Chinese or Thai and Korean particles, and skips titles that are too short or too common. You also get the notes back with the first mention of each suggestion turned into a [[link]] — the same engine as Knotwork’s “Suggested links”.\n\nMethodology:\n- Notes and titles are split into words and normalised the same way: Unicode NFKC, lower case, accents removed for Latin, Greek and Cyrillic letters (é → e, ß → ss), Arabic vowel marks and Hebrew points removed. Indic vowel signs stay because they are part of the letters.\n- A title matches only complete words in the same order, with any spaces or punctuation between them (“checkout-redesign” matches “Checkout redesign”, “Atlas” does not match “Atlases”). At each position the longest matching title wins. Chinese, Japanese, Thai, Lao, Khmer and Myanmar text has no spaces, so it is compared character by character; a Korean title may be followed by a particle (회의록을).\n- Titles shorter than the minimum, numbers alone, common words (“Notes”, “Todo”, “the” … in seven languages) and titles that occur in more than 5 % of at least 20 notes are not suggested. A note never suggests itself; notes that already link to each other with [[…]] (in either direction) are skipped.\n- Score 0.05–1: 0.4, plus 0.15 per extra word (up to 3), 0.1 for names of 8 letters or more and 0.1 per repeated mention (up to 3), minus 0.2 when several notes share the name. Each text is read once with a word trie, so the cost grows with the length of the notes; at most 4,000,000 characters are searched.\n- The linked notes replace the first mention of each suggestion that points to exactly one title with [[Title]] (or [[Title|words as written]]).",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "knotwork_link_suggestions",
        "x-owner-app": "knotwork",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KnotworkLinkSuggestionsInput"
              },
              "examples": {
                "example1": {
                  "summary": "Team wiki: unlinked mentions of other notes and of two extra pages",
                  "value": {
                    "notes": "=== Onboarding\nStart with the Team handbook. Ask Ana for access to the tools we use.\n=== Team handbook\nHow we work: meeting rules, the release process and our [[Glossary]].\n=== Release process\nEvery second Tuesday. Run the deployment checklist first; the Release Process page is the source of truth.\n=== Meeting rules\nShort, with an agenda. Decisions go to the decision log.\n=== Glossary\nWords we use. See the team handbook.\n=== Tools we use\nIssue tracker, chat and the wiki.",
                    "titles": "Decision log | decisions\nDeployment checklist"
                  }
                },
                "example2": {
                  "summary": "Notes in German with accents and # headings",
                  "value": {
                    "notes": "# Übergabe\nDie Checkliste für den Releaseprozess liegt im Wiki, siehe auch Qualitätssicherung.\n# Releaseprozess\nJeden zweiten Dienstag.\n# Qualitätssicherung\nTests vor jedem Release.",
                    "titles": ""
                  }
                },
                "example3": {
                  "summary": "Chinese and Japanese notes (no spaces between words)",
                  "value": {
                    "notes": "=== 会议记录\n下次讨论项目计划。\n=== 项目计划\n第一阶段。\n=== メモ\n会議記録はここ。\n=== 会議記録\n毎週。",
                    "titles": ""
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KnotworkLinkSuggestionsResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tools/graph-algorithm-visualizer/calculate": {
      "post": {
        "operationId": "calculateGraphAlgorithmVisualizer",
        "summary": "BFS, DFS, Dijkstra, Bellman–Ford, A*, MST, topological sort and SCCs on your edge list.",
        "description": "Paste an edge list (weighted or not, directed or not) and run a classic graph algorithm: BFS, DFS, Dijkstra, Bellman–Ford (with negative-cycle detection), A* with node coordinates, Prim or Kruskal minimum spanning tree, Kahn topological sort or Tarjan strongly connected components. Shows every step, the distances and the highlighted path or tree.\n\nMethodology:\n- Neighbours are visited in the order nodes first appear in your edge list, so every run is deterministic. Undirected edges are usable in both directions.\n- BFS finds fewest-edge paths; DFS records discovery and finish times. Dijkstra settles nodes in order of distance with a binary heap and refuses negative weights; Bellman–Ford relaxes all edges up to n − 1 times and then checks for a negative cycle.\n- A* is Dijkstra ordered by g + h with h = straight-line distance between coordinates. It returns optimal paths when h never overestimates (admissible) and is consistent; the tool warns when an edge is shorter than its straight-line length.\n- Prim grows a tree from the start node (a forest if the graph is disconnected); Kruskal adds the cheapest edges that do not close a cycle (union–find). Kahn's algorithm outputs nodes without remaining incoming edges and detects cycles; Tarjan's algorithm finds strongly connected components in one DFS.",
        "tags": [
          "math"
        ],
        "x-mcp-tool": "graph_algorithm_visualizer",
        "x-owner-app": "proofline",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GraphAlgorithmVisualizerInput"
              },
              "examples": {
                "example1": {
                  "summary": "Dijkstra from A to F",
                  "value": {
                    "algorithm": "dijkstra",
                    "source": "A",
                    "target": "F"
                  }
                },
                "example2": {
                  "summary": "Kruskal MST",
                  "value": {
                    "algorithm": "kruskal"
                  }
                },
                "example3": {
                  "summary": "Topological sort of build steps",
                  "value": {
                    "directed": true,
                    "algorithm": "topo",
                    "edges": "fetch compile\ncompile test\ncompile package\ntest release\npackage release\nlint release"
                  }
                },
                "example4": {
                  "summary": "Bellman–Ford with a negative edge",
                  "value": {
                    "directed": true,
                    "algorithm": "bellman-ford",
                    "source": "S",
                    "target": "D",
                    "edges": "S A 4\nS B 5\nA C -3\nB C 2\nC D 2\nB D 6"
                  }
                },
                "example5": {
                  "summary": "A* on a grid",
                  "value": {
                    "algorithm": "astar",
                    "source": "S",
                    "target": "G",
                    "edges": "S A 1\nA B 1\nB G 1\nS C 1.5\nC D 1.5\nD G 1.5\nA C 1",
                    "coordinates": "S 0 0\nA 1 0\nB 2 0\nG 3 0\nC 0.5 1\nD 2 1"
                  }
                },
                "example6": {
                  "summary": "Strongly connected components",
                  "value": {
                    "directed": true,
                    "algorithm": "scc",
                    "edges": "1 2\n2 3\n3 1\n3 4\n4 5\n5 6\n6 4\n7 6\n7 8\n8 7"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GraphAlgorithmVisualizerResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/workflows": {
      "get": {
        "operationId": "listWorkflows",
        "summary": "Multi-tool workflows",
        "responses": {
          "200": {
            "description": "Workflow list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "KnotworkLinkGraphInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "graph": {
            "title": "Links (one per line: from -\u003e to) or graph JSON",
            "description": "Lines like “A -\u003e B”, “A → B”, “A, B” or tab-separated. A line with one name adds an item without links; # starts a comment. JSON: { \"nodes\": [{ \"id\", \"title\", \"kind\" }], \"edges\": [{ \"from\", \"to\", \"kind\" }] } — the format Knotwork exports. At most 20,000 nodes and 100,000 links.",
            "type": "string",
            "maxLength": 4000000,
            "default": "# Product team knowledge: one link per line (from -\u003e to)\nRoadmap 2027 -\u003e Checkout redesign\nRoadmap 2027 -\u003e Mobile app\nCheckout redesign -\u003e WEB-12 Payment form\nCheckout redesign -\u003e WEB-14 Address autocomplete\nWEB-12 Payment form -\u003e WEB-14 Address autocomplete\nWEB-15 Card validation -\u003e WEB-12 Payment form\nMobile app -\u003e APP-3 Offline mode\n#design-review message -\u003e Checkout redesign\n#design-review message -\u003e WEB-12 Payment form\nCard: Usability test -\u003e Checkout redesign\nAna -\u003e WEB-12 Payment form\nBen -\u003e APP-3 Offline mode\nOld onboarding notes"
          },
          "from": {
            "title": "Path from (node id, optional)",
            "type": "string",
            "maxLength": 200,
            "default": ""
          },
          "to": {
            "title": "Path to (node id, optional)",
            "type": "string",
            "maxLength": 200,
            "default": ""
          },
          "directed": {
            "title": "Path follows link direction only",
            "type": "boolean",
            "default": false
          },
          "top": {
            "title": "Hubs and PageRank: show the top",
            "type": "number",
            "minimum": 1,
            "maximum": 100,
            "default": 10
          },
          "damping": {
            "title": "PageRank damping factor",
            "description": "Probability that the random surfer follows a link instead of jumping anywhere. 0.85 is the classic value.",
            "type": "number",
            "minimum": 0,
            "maximum": 0.99,
            "default": 0.85
          }
        },
        "required": [
          "graph"
        ]
      },
      "KnotworkLinkGraphResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "nodes",
              "edges",
              "components",
              "degree",
              "pageRank",
              "hubs",
              "topPageRank",
              "orphans",
              "stats"
            ],
            "properties": {
              "nodes": {
                "type": "integer"
              },
              "edges": {
                "type": "integer",
                "description": "Distinct directed links (duplicates and self-loops removed)."
              },
              "density": {
                "type": "number"
              },
              "components": {
                "type": "object",
                "properties": {
                  "count": {
                    "type": "integer"
                  },
                  "largest": {
                    "type": "integer"
                  },
                  "sizes": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    }
                  }
                }
              },
              "degree": {
                "type": "object",
                "properties": {
                  "min": {
                    "type": "integer"
                  },
                  "max": {
                    "type": "integer"
                  },
                  "mean": {
                    "type": "number"
                  },
                  "median": {
                    "type": "number"
                  }
                }
              },
              "pageRank": {
                "type": "object",
                "properties": {
                  "damping": {
                    "type": "number"
                  },
                  "iterations": {
                    "type": "integer"
                  },
                  "converged": {
                    "type": "boolean"
                  }
                }
              },
              "hubs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "in": {
                      "type": "integer"
                    },
                    "out": {
                      "type": "integer"
                    },
                    "degree": {
                      "type": "integer"
                    },
                    "pageRank": {
                      "type": "number"
                    },
                    "component": {
                      "type": "integer"
                    }
                  }
                }
              },
              "topPageRank": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "in": {
                      "type": "integer"
                    },
                    "out": {
                      "type": "integer"
                    },
                    "degree": {
                      "type": "integer"
                    },
                    "pageRank": {
                      "type": "number"
                    },
                    "component": {
                      "type": "integer"
                    }
                  }
                }
              },
              "orphans": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    }
                  }
                }
              },
              "path": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "found": {
                    "type": "boolean"
                  },
                  "length": {
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "nodes": {
                    "type": "array"
                  }
                }
              },
              "stats": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "in": {
                      "type": "integer"
                    },
                    "out": {
                      "type": "integer"
                    },
                    "degree": {
                      "type": "integer"
                    },
                    "pageRank": {
                      "type": "number"
                    },
                    "component": {
                      "type": "integer"
                    }
                  }
                },
                "description": "Every node in input order."
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "KnotworkWikilinkMapInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "notes": {
            "title": "Notes (each starts with a line “=== Title”)",
            "description": "Without any “=== Title” line, “# Title” headings start the notes. Links match titles case-insensitively.",
            "type": "string",
            "maxLength": 4000000,
            "default": "=== Onboarding\nStart with [[Team handbook]] and [[Tools we use]]. Ask @[Ana Silva] for access.\n=== Team handbook\nHow we work: see [[Meeting rules]] and [[Release process]].\n=== Release process\nChecklist in [[Tools we use]]. Owner: @[Ben Okafor]. Old notes: [[Release 2025]].\n=== Tools we use\nIssue tracker, chat and the wiki. Back to [[Onboarding]].\n=== Meeting rules\nShort, with an agenda.\n=== Parking\nGarage on level -2."
          },
          "top": {
            "title": "Show the top hubs",
            "type": "number",
            "minimum": 1,
            "maximum": 100,
            "default": 10
          }
        },
        "required": [
          "notes"
        ]
      },
      "KnotworkWikilinkMapResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "pages",
              "links",
              "broken",
              "graph",
              "analysis"
            ],
            "properties": {
              "pages": {
                "type": "integer"
              },
              "links": {
                "type": "integer",
                "description": "Wiki and .md links found (resolved or not)."
              },
              "mentions": {
                "type": "integer"
              },
              "external": {
                "type": "integer"
              },
              "broken": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "fromTitle": {
                      "type": "string"
                    },
                    "target": {
                      "type": "string"
                    }
                  }
                }
              },
              "duplicateTitles": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "graph": {
                "type": "object",
                "description": "nodes (page:N, person:N) and edges (kind link or mention) — open it in Knotwork or the link graph analyser."
              },
              "analysis": {
                "type": "object",
                "description": "Same report as knotwork-link-graph (people are not counted as hubs or orphans)."
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "KnotworkLinkSuggestionsInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "notes": {
            "title": "Notes (each starts with a line “=== Title”)",
            "description": "Without any “=== Title” line, “# Title” headings start the notes. Existing [[links]], code and web addresses are not searched.",
            "type": "string",
            "maxLength": 4000000,
            "default": "=== Onboarding\nStart with the Team handbook. Ask Ana for access to the tools we use.\n=== Team handbook\nHow we work: meeting rules, the release process and our [[Glossary]].\n=== Release process\nEvery second Tuesday. Run the deployment checklist first; the Release Process page is the source of truth.\n=== Meeting rules\nShort, with an agenda. Decisions go to the decision log.\n=== Glossary\nWords we use. See the team handbook.\n=== Tools we use\nIssue tracker, chat and the wiki."
          },
          "titles": {
            "title": "More titles to look for (optional, one per line)",
            "description": "Pages that are not in the pasted notes, e.g. other pages of your wiki. Other names of the same page after a | sign.",
            "type": "string",
            "maxLength": 200000,
            "default": ""
          },
          "minChars": {
            "title": "Ignore titles shorter than (letters)",
            "description": "Scripts written without spaces (Chinese, Japanese, Thai …) need at least 2 characters.",
            "type": "number",
            "minimum": 1,
            "maximum": 20,
            "default": 3
          },
          "perNote": {
            "title": "Suggestions per note (at most)",
            "type": "number",
            "minimum": 1,
            "maximum": 200,
            "default": 20
          }
        },
        "required": [
          "notes"
        ]
      },
      "KnotworkLinkSuggestionsResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "notes",
              "names",
              "suggestions",
              "linkedNotes",
              "added",
              "stats"
            ],
            "properties": {
              "notes": {
                "type": "integer"
              },
              "names": {
                "type": "integer",
                "description": "Distinct names searched (titles and other names that were not too short or too common)."
              },
              "suggestions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "fromTitle": {
                      "type": "string"
                    },
                    "toTitle": {
                      "type": "string"
                    },
                    "matched": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "score": {
                      "type": "number"
                    },
                    "snippet": {
                      "type": "string"
                    },
                    "offset": {
                      "type": "integer"
                    },
                    "span": {
                      "type": "integer"
                    },
                    "ambiguous": {
                      "type": "boolean"
                    }
                  }
                }
              },
              "linkedNotes": {
                "type": "string",
                "description": "The notes with the first mention of each unambiguous suggestion turned into a [[link]]."
              },
              "added": {
                "type": "integer"
              },
              "stats": {
                "type": "object"
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "GraphAlgorithmVisualizerInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "edges": {
            "title": "Edges (one per line: from to [weight])",
            "description": "Formats: \"A B 4\", \"A -\u003e B 4\", \"A,B,4\". A line with one name adds an isolated node. # starts a comment. Max 200 nodes, 2,000 edges.",
            "type": "string",
            "maxLength": 40000,
            "default": "A B 4\nA C 2\nB C 5\nB D 10\nC E 3\nE D 4\nD F 11"
          },
          "directed": {
            "title": "Directed edges",
            "type": "boolean",
            "default": false
          },
          "algorithm": {
            "title": "Algorithm",
            "type": "string",
            "enum": [
              "bfs",
              "dfs",
              "dijkstra",
              "bellman-ford",
              "astar",
              "prim",
              "kruskal",
              "topo",
              "scc"
            ],
            "default": "dijkstra"
          },
          "source": {
            "title": "Start node",
            "description": "Default: the first node. Used by BFS, DFS, Dijkstra, Bellman–Ford, A* and Prim.",
            "type": "string",
            "maxLength": 40
          },
          "target": {
            "title": "Target node",
            "description": "Optional for searches; required for A*.",
            "type": "string",
            "maxLength": 40
          },
          "coordinates": {
            "title": "Node coordinates (node x y), for A* and layout",
            "description": "A* uses the straight-line distance as heuristic; it is admissible only if no edge is shorter than the distance between its end points.",
            "type": "string",
            "maxLength": 20000
          }
        },
        "required": [
          "edges"
        ]
      },
      "GraphAlgorithmVisualizerResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "required": [
              "algorithm",
              "directed",
              "weighted",
              "nodeCount",
              "edgeCount",
              "steps"
            ],
            "properties": {
              "algorithm": {
                "type": "string"
              },
              "directed": {
                "type": "boolean"
              },
              "weighted": {
                "type": "boolean"
              },
              "nodeCount": {
                "type": "integer"
              },
              "edgeCount": {
                "type": "integer"
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "target": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "order": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Visit / settle / output order."
              },
              "distances": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "node",
                    "distance",
                    "previous"
                  ],
                  "properties": {
                    "node": {
                      "type": "string"
                    },
                    "distance": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "previous": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "path": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "pathCost": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "mst": {
                "type": [
                  "object",
                  "null"
                ],
                "properties": {
                  "total": {
                    "type": "number"
                  },
                  "edges": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "components": {
                    "type": "integer"
                  }
                }
              },
              "topologicalOrder": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "components": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              },
              "negativeCycle": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "steps": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "step",
                    "detail"
                  ],
                  "properties": {
                    "step": {
                      "type": "integer"
                    },
                    "action": {
                      "type": "string"
                    },
                    "node": {
                      "type": "string"
                    },
                    "detail": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}