There was a really neat 3rd party book that had something that could be applicable here. (I think it was the Artificer's Handbook.)
Essentially, the item is crafted by binding a reasonably powerful outsider into it. (IIRC it was usually unwilling.) When the item is broken, the outsider is released. Weapons made this way take on some of the characteristics of the bound outsider, so it would be a good outsider in this case. Assuming it was imprisoned in there, it would be pretty grateful to be released.
Presto, instant powerful ally! It's even RAW.

-blarg
ps - Heck, it could even be a good source of plot hooks. The freed outsider could hire the party to track down and chastise the evil artificer that trapped it in the sword.